In [1]:
import pandas as pd
import numpy as np
In [2]:
import sys
sys.path.append('../automl')
from auto_learner import AutoLearner
In [4]:
data = pd.read_csv('dataset_8_preprocessed.csv', header=None).values
features = data[:,0:-1]
labels = data[:,-1]
In [5]:
learner = AutoLearner(selected_algorithms='less', selected_hyperparameters='less', n_cores=2)
learner.fit(features, labels)
/Users/craig/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/stochastic_gradient.py:117: DeprecationWarning: n_iter parameter is deprecated in 0.19 and will be removed in 0.21. Use max_iter and tol instead.
DeprecationWarning)
/Users/craig/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/stochastic_gradient.py:117: DeprecationWarning: n_iter parameter is deprecated in 0.19 and will be removed in 0.21. Use max_iter and tol instead.
DeprecationWarning)
/Users/craig/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/stochastic_gradient.py:117: DeprecationWarning: n_iter parameter is deprecated in 0.19 and will be removed in 0.21. Use max_iter and tol instead.
DeprecationWarning)
/Users/craig/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/stochastic_gradient.py:117: DeprecationWarning: n_iter parameter is deprecated in 0.19 and will be removed in 0.21. Use max_iter and tol instead.
DeprecationWarning)
/Users/craig/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/stochastic_gradient.py:117: DeprecationWarning: n_iter parameter is deprecated in 0.19 and will be removed in 0.21. Use max_iter and tol instead.
DeprecationWarning)
/Users/craig/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/stochastic_gradient.py:117: DeprecationWarning: n_iter parameter is deprecated in 0.19 and will be removed in 0.21. Use max_iter and tol instead.
DeprecationWarning)
/Users/craig/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/stochastic_gradient.py:117: DeprecationWarning: n_iter parameter is deprecated in 0.19 and will be removed in 0.21. Use max_iter and tol instead.
DeprecationWarning)
/Users/craig/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/stochastic_gradient.py:117: DeprecationWarning: n_iter parameter is deprecated in 0.19 and will be removed in 0.21. Use max_iter and tol instead.
DeprecationWarning)
/Users/craig/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/stochastic_gradient.py:117: DeprecationWarning: n_iter parameter is deprecated in 0.19 and will be removed in 0.21. Use max_iter and tol instead.
DeprecationWarning)
/Users/craig/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/stochastic_gradient.py:117: DeprecationWarning: n_iter parameter is deprecated in 0.19 and will be removed in 0.21. Use max_iter and tol instead.
DeprecationWarning)
../automl/low_rank_models.py:30: FutureWarning: `rcond` parameter will change to the default of machine precision times ``max(M, N)`` where M and N are the input matrix dimensions.
To use the future default and silence this warning we advise to pass `rcond=None`, to keep using the old, explicitly pass `rcond=-1`.
x = np.linalg.lstsq(np.matrix.transpose(Y[:, known_indices]), np.matrix.transpose(a[:, known_indices]))[0].T
kNN finished (k=13, shape=(345, 5))
kNN finished (k=3, shape=(345, 5))
kNN finished (k=6, shape=(345, 5))
LinearSVM finished (C=0.75, shape=(345, 5))
kNN finished (k=7, shape=(345, 5))
WARNING:smac.intensification.intensification.Intensifier:Challenger was the same as the current incumbent; Skipping challenger
kNN finished (k=11, shape=(345, 5))
kNN finished (k=13, shape=(345, 5))
LinearSVM finished (C=0.5409622191192307, shape=(345, 5))
CART finished (min_samples_split=0.001, shape=(345, 5))
CART finished (min_samples_split=0.00314171995319064, shape=(345, 5))
CART finished (min_samples_split=0.0036582624792167824, shape=(345, 5))
CART finished (min_samples_split=0.003513753307631745, shape=(345, 5))
LinearSVM finished (C=0.8890850188818187, shape=(345, 5))
CART finished (min_samples_split=0.008249889509597923, shape=(345, 5))
CART finished (min_samples_split=0.008024515983158259, shape=(345, 5))
CART finished (min_samples_split=0.0062387538004340945, shape=(345, 5))
CART finished (min_samples_split=0.0027100110955989875, shape=(345, 5))
CART finished (min_samples_split=0.008775534859652384, shape=(345, 5))
CART finished (min_samples_split=0.007337899969732696, shape=(345, 5))
LinearSVM finished (C=0.9746545188928326, shape=(345, 5))
CART finished (min_samples_split=0.001, shape=(345, 5))
LinearSVM finished (C=1.6934240882679044, shape=(345, 5))
LinearSVM finished (C=0.6734528496911161, shape=(345, 5))
LinearSVM finished (C=1.3411230381140806, shape=(345, 5))
LinearSVM finished (C=0.34703410102506194, shape=(345, 5))
LinearSVM finished (C=0.488883141328918, shape=(345, 5))
LinearSVM finished (C=0.4603466685662987, shape=(345, 5))
LinearSVM finished (C=0.75, shape=(345, 5))
kNN finished (k=13, shape=(345, 5))
CART finished (min_samples_split=0.001, shape=(345, 5))
LinearSVM finished (C=0.75, shape=(345, 5))
Logistic Regression finished (C=1.0, shape=(345, 3))
Logistic Regression finished (C=0.5409622191192307, shape=(345, 3))
Logistic Regression finished (C=0.8890850188818187, shape=(345, 3))
Logistic Regression finished (C=0.9746545188928326, shape=(345, 3))
Logistic Regression finished (C=1.6934240882679044, shape=(345, 3))
Logistic Regression finished (C=0.6734528496911161, shape=(345, 3))
Logistic Regression finished (C=1.3411230381140806, shape=(345, 3))
Logistic Regression finished (C=1.756581170310755, shape=(345, 3))
Logistic Regression finished (C=0.488883141328918, shape=(345, 3))
Logistic Regression finished (C=1.1448464148397057, shape=(345, 3))
Logistic Regression finished (C=1.6934240882679044, shape=(345, 3))
Logistic Regression finished (C=1.6934240882679044, shape=(345, 3))
In [6]:
learner.refit(features, labels)
kNN finished (k=13, shape=(345, 5))
CART finished (min_samples_split=0.001, shape=(345, 5))
LinearSVM finished (C=0.75, shape=(345, 5))
Logistic Regression finished (C=1.6934240883, shape=(345, 3))
Logistic Regression finished (C=0.37100087446545293, shape=(345, 3))
Logistic Regression finished (C=0.8890850188818187, shape=(345, 3))
Logistic Regression finished (C=1.038524114122989, shape=(345, 3))
Logistic Regression finished (C=1.6941795798024304, shape=(345, 3))
Logistic Regression finished (C=1.1084501898186552, shape=(345, 3))
Logistic Regression finished (C=0.34510998722851305, shape=(345, 3))
Logistic Regression finished (C=0.9262139656075676, shape=(345, 3))
Logistic Regression finished (C=1.5960580763446948, shape=(345, 3))
Logistic Regression finished (C=1.267221839955445, shape=(345, 3))
Logistic Regression finished (C=1.6934240883, shape=(345, 3))
Logistic Regression finished (C=1.6934240883, shape=(345, 3))
In [8]:
import ML_algorithms as ml
ml.error_calc(labels, learner.predict(features))
Out[8]:
0.49442040858594133
In [9]:
(labels == learner.predict(features)).sum()/len(labels)
Out[9]:
0.34202898550724636
In [10]:
learner.ensemble.get_base_learner_params()
Out[10]:
{'CART': {'min_samples_split': 0.001}, 'kNN': {'k': 13}, 'lSVM': {'C': 0.75}}
In [11]:
for model in learner.ensemble.base_learners:
print(model.error)
0.4899489098940458
0.4812616026827904
0.5041568825243941
Content source: yujiakimoto/lowrankautoml
Similar notebooks: