Open skycrazer opened 7 years ago
I'm not sure what is causing that error, hpsklearn
shouldn't depend on skdata
anymore. It's possible you might be using an older version. I just tried installing the version from master into a virtualenv and it works for both Python 2 and 3.
The notebook examples still use skdata
, so if you are running those you'll need to install it as well. It wasn't designed for Python 3 so it may not work with that.
There are some other examples here on the website that don't use skdata
.
Im using hpsklearn 0.0.1 Is this the latest version?
I manually copied hpsklearn folder from this git to the site-packages folder from anaconda and got this message:
import hpsklearn C:\Program Files\Anaconda3\lib\site-packages\sklearn\cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into 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) diagnosis 0 35 1 12 dtype: int64 Traceback (most recent call last):
File "
File "C:\Users\SK\hpsklearn.py", line 41, in
File "C:\Program Files\Anaconda3\lib\site-packages\skdata\iris__init__.py", line 1, in
ImportError: cannot import name 'Iris'
Still not working.. Do I need to downgrade to Python 2? Not really a solution.. many other modules wont work then.
Unfortunately the only supported way to install hyperopt-sklearn is to clone the repo and do pip install -e .
within the folder. I'm planning on cleaning some things up and doing the first PyPI release sometime in the next few weeks when I have time, which should make this easier in the future (and possibly making it conda installable as well). It should be possible to install packages within Anaconda with pip. I know that installing within virtualenv
works for sure.
I did some looking around and it seems there is a really old version that is conda installable floating around. I'm not sure who put that there, but it is definitely not the correct one. There is no file called hpsklearn.py
in this project, so when you are importing it seems to be somehow finding this other version to get that error. I'd suggest removing it and installing the version on master
with pip
.
Thanks for the advice. Now I'm getting the following warning when importing hpsklearn:
">> import hpsklearn WARN: OMP_NUM_THREADS=None => If you are using openblas if you are using openblas set OMP_NUM_THREADS=1 or risk subprocess calls hanging indefinitely C:\Program Files\Anaconda3\lib\site-packages\sklearn\cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into 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)"
What is this all about? Any suggestions? Thanks.
The first warning is letting you know that if you are using a particular linear algebra library (OpenBLAS
) you could run into problems. I've never seen it be an issue, but you can run export OMP_NUM_THREADS=1
just in case and it will make the warning go away.
The second warning is saying a few modules in sklearn
are getting moved around in the future. It doesn't affect anything right now, but I'll have to update it before version 0.20 of sklearn.
Would you advice putting the command export OMP_NUM_THREADS=1 to the .bash_profile of a mac? Because i find myself repeating this step frequently on my experiments @bjkomer.
I just added it. And now it works fine.
I am getting this error
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2017.3.2\helpers\pydev\pydev_run_in_console.py", line 53, in run_file
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2017.3.2\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/User/PycharmProjects/summer_work/hyperopt.py", line 4, in
Try and run this on command line for example python nameofscript.py
then you can redirect your output to a file for instance python nameofscript.py > resulttrial.txt
. I'm seeing your using pycharm maybe that could be the problem. On the other hand, jupyter notebooks run these fine never done it on pycharm. @parampopat
The first warning is letting you know that if you are using a particular linear algebra library (
OpenBLAS
) you could run into problems. I've never seen it be an issue, but you can runexport OMP_NUM_THREADS=1
just in case and it will make the warning go away.The second warning is saying a few modules in
sklearn
are getting moved around in the future. It doesn't affect anything right now, but I'll have to update it before version 0.20 of sklearn.
export OMP_NUM_THREADS=1
doesn't run .Please let me know how to run this in python 3.
@PhanindraPanthagani that command is meant to be run in a terminal to set an environment variable. In order to not have to type it every time you can set it in your .bashrc
(or equivalent file for your operating system) as Shuyib mentioned above. The export
works for linux/mac. If you're using windows the syntax might be different depending on your command line terminal.
You can also set it using Python if you would like. Something like this near the top of your file:
import os
os.environ['OMP_NUM_THREADS'] = "1"
@bjkomer thanks, I have set it to 1 and I am running this in jupyter notebook. Does hpsklearn work in jupyter notebook? I am getting a strange error that its not able pickle module objects as below. I cloned the latest hyperopt and latest hpsklearn from github and trying to run the code. Please find the error below. I am trying to use "AUC_ROC" as a new continous loss function instead of default Accuracy . Please let me know how to resolve this issue :
****module 'roclossfn' from 'C:\Users\pp5950\OneDrive - Lennox International, Inc\AutoML\roclossfn.py'> (34170, 79) (34170,) estim is hyperopt_estimator(algo=<function suggest at 0x00000209BAB75C80>, classifier=None, continuous_loss_fn=True, ex_preprocs=None, fit_increment=1, fit_increment_dump_filename=None, loss_fn=<module 'roclossfn' from 'C:\Users\pp5950\OneDrive - Lennox International, Inc\AutoML\roclossfn.py'>, max_evals=30, preprocessing=None, refit=True, regressor=None, seed=300, space=<hyperopt.pyll.base.Apply object at 0x00000209C3C945C0>, trial_timeout=300, use_partial_fit=False, verbose=False) 0%| | 0/1 [00:00<?, ?it/s, best loss: ?]
TypeError Traceback (most recent call last)
As Hyperopt-sklearn needs a specific installation (pip install git+https://github.com/hyperopt/hyperopt-sklearn
, see doc), there is an additional manipulation to install the package in Venv with Pycharm.
Add pip instruction in Options
box.
Unfortunately, i'm getting the following error message when trying to import hpsklear:
File "", line 1, in
import hpsklearn
File "C:\Users\SK\hpsklearn.py", line 41, in
import skdata.iris.view
ImportError: No module named 'skdata'
Im using Spyder 3.1.4 and Python 3.5.
Appreciate any suggestions for a solution. Thanks.