hyperopt / hyperopt-sklearn

Hyper-parameter optimization for sklearn
hyperopt.github.io/hyperopt-sklearn
Other
1.58k stars 271 forks source link

ValueError: Iteration of zero-sized operands is not enabled #63

Open pulkitkumar95 opened 7 years ago

pulkitkumar95 commented 7 years ago

I am trying to use hyperopt-sklearn for classification. My data has about 1500 samples each having about 16000 features.

I have initialized my hyperopt estimator by:-

estim = hpsklearn.HyperoptEstimator( preprocessing=hpsklearn.components.any_preprocessing('pp'), classifier=hpsklearn.components.any_classifier('clf'), algo=hyperopt.tpe.suggest, trial_timeout=3000, # seconds max_evals=15, verbose=True )

I am constantly getting this error:

Traceback (most recent call last): File "stage4_transfer_with_hyperopt.py", line 280, in estim.fit(to_fit,to_fit_label) File "build/bdist.linux-x86_64/egg/hpsklearn/estimator.py", line 705, in fit File "build/bdist.linux-x86_64/egg/hpsklearn/estimator.py", line 616, in fit_iter File "/usr/local/lib/python2.7/dist-packages/hyperopt-0.1-py2.7.egg/hyperopt/fmin.py", line 307, in fmin return_argmin=return_argmin, File "/usr/local/lib/python2.7/dist-packages/hyperopt-0.1-py2.7.egg/hyperopt/base.py", line 635, in fmin return_argmin=return_argmin) File "/usr/local/lib/python2.7/dist-packages/hyperopt-0.1-py2.7.egg/hyperopt/fmin.py", line 320, in fmin rval.exhaust() File "/usr/local/lib/python2.7/dist-packages/hyperopt-0.1-py2.7.egg/hyperopt/fmin.py", line 199, in exhaust self.run(self.max_evals - n_done, block_until_done=self.async) File "/usr/local/lib/python2.7/dist-packages/hyperopt-0.1-py2.7.egg/hyperopt/fmin.py", line 173, in run self.serial_evaluate() File "/usr/local/lib/python2.7/dist-packages/hyperopt-0.1-py2.7.egg/hyperopt/fmin.py", line 92, in serial_evaluate result = self.domain.evaluate(spec, ctrl) File "/usr/local/lib/python2.7/dist-packages/hyperopt-0.1-py2.7.egg/hyperopt/base.py", line 840, in evaluate rval = self.fn(pyll_rval) File "build/bdist.linux-x86_64/egg/hpsklearn/estimator.py", line 579, in fn_with_timeout ValueError: Iteration of zero-sized operands is not enabled

bjkomer commented 7 years ago

This seems to be a problem with the latest version of numpy (1.12.0). Switching to 1.11.0 should fix it. You can do that with pip install -I numpy==1.11.0