Open AStupidBear opened 7 years ago
I think hyperopt wasn't updated to work with newer sklearn (and probably python 3.6).
The simplest would be that you downgrade sklearn. Otherwise, you will need to try to add the support of the newer version.
p.s. I don't use hyper-opt, I just follow it.
On Fri, Feb 10, 2017 at 6:40 AM Yao Lu notifications@github.com wrote:
running
import numpy as np import skdata.iris.view import hyperopt.tpe import hpsklearn import hpsklearn.demo_support import time
data_view = skdata.iris.view.KfoldClassification(4) attrs = 'petal_length', 'petal_width', 'sepal_length', 'sepal_width' labels = 'setosa', 'versicolor', 'virginica' X_all = np.asarray([map(d.getitem, attrs) for d in data_view.dataset.meta]) y_all = np.asarray([labels.index(d['name']) for d in data_view.dataset.meta]) idx_all = np.random.RandomState(1).permutation(len(y_all)) idx_train = idx_all[:int(.8 len(y_all))] idx_test = idx_all[int(.8 len(y_all)):]
TRAIN AND TEST DATA
X_train = X_all[idx_train] y_train = y_all[idx_train] X_test = X_all[idx_test] y_test = y_all[idx_test]
estimator = hpsklearn.HyperoptEstimator( preprocessing=hpsklearn.components.any_preprocessing('pp'), classifier=hpsklearn.components.any_classifier('clf'), algo=hyperopt.tpe.suggest, trial_timeout=15.0, # seconds max_evals=15, )
Demo version of estimator.fit()
es = estimator.fit(X_train,y_train)
gives
C:\PortableSoftware\Scoop\apps\python\current\lib\site-packages\sklearn\cross_validation.py:44: Depr ecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module in to which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20. "This module will be removed in 0.20.", DeprecationWarning) Traceback (most recent call last): File "
", line 1, in File "c:\users\astupidbear\documents\codes\julia\hpsklearn\deps\hyperopt-sklearn\hpsklearn\estimat or.py", line 705, in fit fit_iter.send(increment) File "c:\users\astupidbear\documents\codes\julia\hpsklearn\deps\hyperopt-sklearn\hpsklearn\estimat or.py", line 616, in fit_iter return_argmin=False, # -- in case no success so far File "C:\PortableSoftware\Scoop\apps\python\current\lib\site-packages\hyperopt\fmin.py", line 307, in fmin return_argmin=return_argmin, File "C:\PortableSoftware\Scoop\apps\python\current\lib\site-packages\hyperopt\base.py", line 635, in fmin return_argmin=return_argmin) File "C:\PortableSoftware\Scoop\apps\python\current\lib\site-packages\hyperopt\fmin.py", line 320, in fmin rval.exhaust() File "C:\PortableSoftware\Scoop\apps\python\current\lib\site-packages\hyperopt\fmin.py", line 199, in exhaust self.run(self.max_evals - n_done, block_until_done=self.async) File "C:\PortableSoftware\Scoop\apps\python\current\lib\site-packages\hyperopt\fmin.py", line 173, in run self.serial_evaluate() File "C:\PortableSoftware\Scoop\apps\python\current\lib\site-packages\hyperopt\fmin.py", line 92, in serial_evaluate result = self.domain.evaluate(spec, ctrl) File "C:\PortableSoftware\Scoop\apps\python\current\lib\site-packages\hyperopt\base.py", line 840, in evaluate rval = self.fn(pyll_rval) File "c:\users\astupidbear\documents\codes\julia\hpsklearn\deps\hyperopt-sklearn\hpsklearn\estimator.py", line 579, in fn_with_timeout raise fn_rval[1] TypeError: float() argument must be a string or a number, not 'map' — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/hyperopt/hyperopt-sklearn/issues/59, or mute the thread https://github.com/notifications/unsubscribe-auth/AALC-7z25IbdfW9NevBa7fjIPbNfIAnQks5rbEyngaJpZM4L9SkW .
running
gives