scikit-learn-contrib / py-earth

A Python implementation of Jerome Friedman's Multivariate Adaptive Regression Splines
http://contrib.scikit-learn.org/py-earth/
BSD 3-Clause "New" or "Revised" License
459 stars 122 forks source link

NameError: name 'np' is not defined #183

Closed ghost closed 6 years ago

ghost commented 6 years ago

I followed the instruction to install py-earth: https://github.com/scikit-learn-contrib/py-earth/wiki/Installing-py-earth-on-Windows-with-Anaconda-for-Python-2.7

But when I ran the example in readme, getting the following error message:

NameError Traceback (most recent call last)

in () 8 #Fit an Earth model 9 model = Earth() ---> 10 model.fit(X,y) 11 12 #Print the model ~\Anaconda3\lib\site-packages\pyearth\earth.py in fit(self, X, y, sample_weight, output_weight, missing, xlabels, linvars) ~\Anaconda3\lib\site-packages\pyearth\earth.py in forward_pass(self, X, y, sample_weight, output_weight, missing, xlabels, linvars, skip_scrub) pyearth/_forward.pyx in pyearth._forward.ForwardPasser.__init__() NameError: name 'np' is not defined

Any idea? Thank you.

jcrudy commented 6 years ago

@liangweiLiao I'm not sure what's going on there, but it's no longer necessary to install py-earth from source. Instead, you can do

pip install sklearn-contrib-py-earth

which should select and install the correct binary distribution. If for some reason that doesn't work, you can also try conda-forge (assuming you have conda installed):

conda config --add channels conda-forge
conda install sklearn-contrib-py-earth

If for some reason you still need to install from source, please post again with more details about your configuration (python distribution and version, numpy version and installation method, OS, compiler, output of install command) and I'll try to help you. For now I will close this issue, but feel free to still comment or reopen.