In [24]:
import pandas as pd
from glob import glob
from tqdm import tqdm_notebook
from sklearn.cross_validation import train_test_split
from sklearn.metrics import accuracy_score
from evoml.subspacing import FeatureStackerFECV
In [25]:
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
def check_for_benchmarks(X_train, X_test, y_train, y_test, n_estimators):
# The exploration of the dataset by benchmark algorithms
clf = DecisionTreeClassifier(random_state=34092)
clf.fit(X_train, y_train)
pred_DTC = clf.predict(X_test)
a = clf.score(X_test, y_test)
# print('Base DecisionTreeClassifier accuracy: {}'.format(clf.score(X_test, y_test)))
clf = RandomForestClassifier(random_state=34092, n_estimators=n_estimators)
clf.fit(X_train, y_train)
pred_RFC = clf.predict(X_test)
b = clf.score(X_test, y_test)
# print('Base RandomForestClassifier accuracy: {}'.format(clf.score(X_test, y_test)))
clf = GradientBoostingClassifier(random_state=34092, n_estimators=n_estimators)
clf.fit(X_train, y_train)
pred_GBC = clf.predict(X_test)
c = clf.score(X_test, y_test)
# print('Base GradientBoostingClassifier accuracy: {}'.format(clf.score(X_test, y_test)))
# print('')
return a,b,c
In [28]:
evoml_params={
'name': 'Experiment',
'n_estimators': 10,
'cv': 5,
'n_population': 30,
'ngen' : 5
}
In [33]:
logdump = []
for i,dataset in tqdm_notebook(enumerate(glob('C:/Users/harshnisar/Programming/data/*'))):
if i<5: #Max number of datasets you want to do
continue
input_data = pd.read_csv(dataset, compression='gzip', sep='\t')
X, y = input_data.iloc[:,:-1], input_data.iloc[:,-1]
for seed in tqdm_notebook(range(0,5)): #How many per dataset?
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=seed, stratify=y)
dt_score, rf_score, gb_score = check_for_benchmarks(X_train, X_test, y_train, y_test, n_estimators=10)
clf_dt = DecisionTreeClassifier(max_depth=None, random_state=34092)
clf = FeatureStackerFECV(base_estimator=clf_dt, model_type = 'classification',
N_individual=evoml_params['n_estimators'],
ngen=evoml_params['ngen'], verbose_flag = False, N_population=evoml_params['n_population'],
maxOrMin = 1,
featMax = None, featMin=1, folds_CV=evoml_params['cv'])
clf.fit(X_train, y_train)
pred = clf.predict(X_test)
final_test_score = accuracy_score(pred,y_test)
final_train_fitness = clf.hof[0].fitness
log ={
'dataset': dataset,
'seed': seed,
'final_train_fitness': final_train_fitness,
'final_test_score': final_test_score,
'RF_holdout': rf_score,
'DT_holdout': dt_score,
'GB_holdout': gb_score,
'nrows': X.shape[0],
'ncols': X.shape[1]
}
logdump.append(log)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 3 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 3 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 3 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 3 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 3 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 3 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 3 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 1 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 2 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
C:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:516: Warning: The least populated class in y has only 4 members, which is too few. The minimum number of labels for any class cannot be less than n_folds=5.
% (min_labels, self.n_folds)), Warning)
Exception ignored in: <bound method tqdm.__del__ of 29it [00:00, 370.92it/s]>
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\tqdm\_tqdm.py", line 645, in __del__
self.close()
File "C:\Anaconda3\lib\site-packages\tqdm\_tqdm_notebook.py", line 208, in close
if self.n < self.total:
TypeError: unorderable types: int() < NoneType()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-33-aa38fc354b43> in <module>()
21 featMax = None, featMin=1, folds_CV=evoml_params['cv'])
22
---> 23 clf.fit(X_train, y_train)
24 pred = clf.predict(X_test)
25 final_test_score = accuracy_score(pred,y_test)
C:\Users\harshnisar\Programming\bhanu\EvoML\evoml\subspacing\feature_stacker_FECV.py in fit(self, X, y)
157 toolbox.register("select", tools.selTournament, tournsize=3)
158
--> 159 pop = toolbox.population(n=self.N_population)
160 hof = tools.HallOfFame(1, similar=compare_hof);
161 stats = tools.Statistics(lambda ind: ind.fitness.values)
C:\Anaconda3\lib\site-packages\deap\tools\init.py in initRepeat(container, func, n)
21 See the :ref:`list-of-floats` and :ref:`population` tutorials for more examples.
22 """
---> 23 return container(func() for _ in range(n))
24
25 def initIterate(container, generator):
C:\Anaconda3\lib\site-packages\deap\tools\init.py in <genexpr>(.0)
21 See the :ref:`list-of-floats` and :ref:`population` tutorials for more examples.
22 """
---> 23 return container(func() for _ in range(n))
24
25 def initIterate(container, generator):
C:\Anaconda3\lib\site-packages\deap\tools\init.py in initRepeat(container, func, n)
21 See the :ref:`list-of-floats` and :ref:`population` tutorials for more examples.
22 """
---> 23 return container(func() for _ in range(n))
24
25 def initIterate(container, generator):
C:\Anaconda3\lib\site-packages\deap\creator.py in initType(self, *args, **kargs)
148 setattr(self, obj_name, obj())
149 if base.__init__ is not object.__init__:
--> 150 base.__init__(self, *args, **kargs)
151
152 objtype = type(str(name), (base,), dict_cls)
C:\Anaconda3\lib\site-packages\deap\tools\init.py in <genexpr>(.0)
21 See the :ref:`list-of-floats` and :ref:`population` tutorials for more examples.
22 """
---> 23 return container(func() for _ in range(n))
24
25 def initIterate(container, generator):
C:\Users\harshnisar\Programming\bhanu\EvoML\evoml\subspacing\feature_stacker_FECV.py in get_indiv_sample_bag(self, data, output, base_estimator, indiv_replace_flag)
119 self.featMax = data.shape[1]-1
120 feat_name = list(data.columns.values)
--> 121 feat_count = (randint(self.featMin,self.featMax))
122 ind = random.sample(range(0, self.featMax), feat_count)
123 new_feat = []
C:\Anaconda3\lib\random.py in randint(self, a, b)
216 """
217
--> 218 return self.randrange(a, b+1)
219
220 def _randbelow(self, n, int=int, maxsize=1<<BPF, type=type,
C:\Anaconda3\lib\random.py in randrange(self, start, stop, step, _int)
194 return istart + self._randbelow(width)
195 if step == 1:
--> 196 raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width))
197
198 # Non-unit step argument supplied.
ValueError: empty range for randrange() (1,1, 0)
In [35]:
logs = pd.DataFrame(logdump)
In [36]:
logs.dataset.unique().shape
Out[36]:
(24,)
In [38]:
logs
Out[38]:
DT_holdout
GB_holdout
RF_holdout
dataset
final_test_score
final_train_fitness
ncols
nrows
seed
0
0.988335
0.983033
0.980912
C:/Users/harshnisar/Programming/data\allrep.cs...
0.992577
(0.98515773110142324,)
29
3772
0
1
0.976670
0.979852
0.974549
C:/Users/harshnisar/Programming/data\allrep.cs...
0.978791
(0.98267736658972571,)
29
3772
1
2
0.981972
0.972428
0.973489
C:/Users/harshnisar/Programming/data\allrep.cs...
0.983033
(0.98409203614828145,)
29
3772
2
3
0.978791
0.971368
0.972428
C:/Users/harshnisar/Programming/data\allrep.cs...
0.981972
(0.98409884048181928,)
29
3772
3
4
0.986214
0.985154
0.980912
C:/Users/harshnisar/Programming/data\allrep.cs...
0.987275
(0.98515952134318341,)
29
3772
4
5
0.846154
0.692308
0.692308
C:/Users/harshnisar/Programming/data\analcatda...
0.846154
(0.67500000000000004,)
4
50
0
6
0.615385
0.615385
0.692308
C:/Users/harshnisar/Programming/data\analcatda...
0.769231
(0.67500000000000004,)
4
50
1
7
0.307692
0.461538
0.615385
C:/Users/harshnisar/Programming/data\analcatda...
0.461538
(0.74285714285714288,)
4
50
2
8
0.538462
0.615385
0.538462
C:/Users/harshnisar/Programming/data\analcatda...
0.615385
(0.69999999999999996,)
4
50
3
9
0.769231
0.692308
0.615385
C:/Users/harshnisar/Programming/data\analcatda...
0.692308
(0.62976190476190474,)
4
50
4
10
0.809524
0.904762
0.809524
C:/Users/harshnisar/Programming/data\analcatda...
0.761905
(0.85641025641025637,)
3
83
0
11
0.714286
0.666667
0.619048
C:/Users/harshnisar/Programming/data\analcatda...
0.714286
(0.81190476190476191,)
3
83
1
12
0.809524
0.761905
0.857143
C:/Users/harshnisar/Programming/data\analcatda...
0.619048
(0.7404761904761904,)
3
83
2
13
0.666667
0.666667
0.666667
C:/Users/harshnisar/Programming/data\analcatda...
0.666667
(0.80897435897435899,)
3
83
3
14
0.619048
0.619048
0.666667
C:/Users/harshnisar/Programming/data\analcatda...
0.666667
(0.82179487179487187,)
3
83
4
15
0.928910
0.957346
0.957346
C:/Users/harshnisar/Programming/data\analcatda...
0.981043
(0.9841372872241777,)
70
841
0
16
0.952607
0.971564
0.981043
C:/Users/harshnisar/Programming/data\analcatda...
0.985782
(0.98411309055118112,)
70
841
1
17
0.943128
0.938389
0.990521
C:/Users/harshnisar/Programming/data\analcatda...
0.981043
(0.98576169354838716,)
70
841
2
18
0.895735
0.957346
0.981043
C:/Users/harshnisar/Programming/data\analcatda...
0.981043
(0.98573827787655577,)
70
841
3
19
0.895735
0.976303
0.995261
C:/Users/harshnisar/Programming/data\analcatda...
0.990521
(0.98252678415198103,)
70
841
4
20
0.769231
0.769231
0.769231
C:/Users/harshnisar/Programming/data\analcatda...
0.769231
(0.88928571428571423,)
6
50
0
21
0.923077
0.923077
0.846154
C:/Users/harshnisar/Programming/data\analcatda...
0.769231
(0.89642857142857157,)
6
50
1
22
0.846154
0.769231
0.923077
C:/Users/harshnisar/Programming/data\analcatda...
0.769231
(0.94999999999999996,)
6
50
2
23
0.769231
0.846154
0.846154
C:/Users/harshnisar/Programming/data\analcatda...
0.769231
(0.92142857142857137,)
6
50
3
24
0.846154
0.923077
1.000000
C:/Users/harshnisar/Programming/data\analcatda...
0.769231
(0.87142857142857155,)
6
50
4
25
0.400000
0.400000
0.400000
C:/Users/harshnisar/Programming/data\analcatda...
0.400000
(0.67662337662337668,)
11
57
0
26
0.533333
0.466667
0.533333
C:/Users/harshnisar/Programming/data\analcatda...
0.533333
(0.67420634920634925,)
11
57
1
27
0.333333
0.600000
0.466667
C:/Users/harshnisar/Programming/data\analcatda...
0.466667
(0.64777777777777767,)
11
57
2
28
0.333333
0.400000
0.400000
C:/Users/harshnisar/Programming/data\analcatda...
0.400000
(0.65194805194805194,)
11
57
3
29
0.400000
0.400000
0.400000
C:/Users/harshnisar/Programming/data\analcatda...
0.333333
(0.7343434343434343,)
11
57
4
...
...
...
...
...
...
...
...
...
...
90
0.428571
0.571429
0.428571
C:/Users/harshnisar/Programming/data\analcatda...
0.285714
(0.47999999999999998,)
3
28
0
91
0.000000
0.142857
0.142857
C:/Users/harshnisar/Programming/data\analcatda...
0.428571
(0.47000000000000003,)
3
28
1
92
0.571429
0.428571
0.428571
C:/Users/harshnisar/Programming/data\analcatda...
0.285714
(0.14999999999999999,)
3
28
2
93
0.428571
0.428571
0.428571
C:/Users/harshnisar/Programming/data\analcatda...
0.428571
(0.42999999999999999,)
3
28
3
94
0.285714
0.285714
0.428571
C:/Users/harshnisar/Programming/data\analcatda...
0.285714
(0.49333333333333335,)
3
28
4
95
0.500000
0.500000
0.625000
C:/Users/harshnisar/Programming/data\analcatda...
0.500000
(0.83333333333333337,)
2
32
0
96
0.875000
0.875000
0.750000
C:/Users/harshnisar/Programming/data\analcatda...
0.875000
(0.79000000000000004,)
2
32
1
97
0.750000
0.875000
1.000000
C:/Users/harshnisar/Programming/data\analcatda...
0.875000
(0.71000000000000008,)
2
32
2
98
0.750000
0.750000
0.750000
C:/Users/harshnisar/Programming/data\analcatda...
0.875000
(0.88000000000000012,)
2
32
3
99
0.750000
0.875000
0.875000
C:/Users/harshnisar/Programming/data\analcatda...
0.750000
(0.83000000000000007,)
2
32
4
100
1.000000
1.000000
1.000000
C:/Users/harshnisar/Programming/data\analcatda...
1.000000
(1.0,)
3
14
0
101
1.000000
1.000000
1.000000
C:/Users/harshnisar/Programming/data\analcatda...
1.000000
(1.0,)
3
14
1
102
1.000000
1.000000
1.000000
C:/Users/harshnisar/Programming/data\analcatda...
1.000000
(1.0,)
3
14
2
103
1.000000
1.000000
1.000000
C:/Users/harshnisar/Programming/data\analcatda...
1.000000
(1.0,)
3
14
3
104
1.000000
1.000000
1.000000
C:/Users/harshnisar/Programming/data\analcatda...
1.000000
(1.0,)
3
14
4
105
0.545455
0.545455
0.545455
C:/Users/harshnisar/Programming/data\analcatda...
0.727273
(0.87142857142857133,)
11
42
0
106
0.545455
0.545455
0.727273
C:/Users/harshnisar/Programming/data\analcatda...
0.636364
(0.80285714285714282,)
11
42
1
107
0.636364
0.636364
0.636364
C:/Users/harshnisar/Programming/data\analcatda...
0.636364
(0.7790476190476191,)
11
42
2
108
0.636364
0.636364
0.636364
C:/Users/harshnisar/Programming/data\analcatda...
0.636364
(0.81428571428571428,)
11
42
3
109
0.545455
0.545455
0.545455
C:/Users/harshnisar/Programming/data\analcatda...
0.454545
(0.88571428571428579,)
11
42
4
110
0.350000
0.380000
0.310000
C:/Users/harshnisar/Programming/data\analcatda...
0.140000
(0.17968880244512364,)
5
400
0
111
0.300000
0.420000
0.260000
C:/Users/harshnisar/Programming/data\analcatda...
0.150000
(0.27292192564098522,)
5
400
1
112
0.300000
0.370000
0.200000
C:/Users/harshnisar/Programming/data\analcatda...
0.130000
(0.23701466781708369,)
5
400
2
113
0.260000
0.460000
0.270000
C:/Users/harshnisar/Programming/data\analcatda...
0.180000
(0.22678705502898416,)
5
400
3
114
0.320000
0.390000
0.240000
C:/Users/harshnisar/Programming/data\analcatda...
0.150000
(0.24310827081596739,)
5
400
4
115
0.333333
0.400000
0.466667
C:/Users/harshnisar/Programming/data\analcatda...
0.200000
(0.22121212121212119,)
3
60
0
116
0.466667
0.533333
0.266667
C:/Users/harshnisar/Programming/data\analcatda...
0.000000
(0.34857142857142859,)
3
60
1
117
0.333333
0.466667
0.133333
C:/Users/harshnisar/Programming/data\analcatda...
0.066667
(0.33944444444444449,)
3
60
2
118
0.533333
0.600000
0.400000
C:/Users/harshnisar/Programming/data\analcatda...
0.133333
(0.22444444444444445,)
3
60
3
119
0.333333
0.266667
0.200000
C:/Users/harshnisar/Programming/data\analcatda...
0.000000
(0.36071428571428571,)
3
60
4
120 rows × 9 columns
In [ ]:
Content source: bhanu-mnit/EvoML
Similar notebooks: