TinksDad
TinksDad

Reputation: 11

scikit-learn fit function classification

I am using the fit function for classification training in scikit-learn. For example, while using random forests, one typically uses the following type of code:

import sklearn
from sklearn.ensemble import RandomForestClassifier as RF
forest=RF(n_estimators=10)
forest=forest.fit(TrainingX,Trainingy)

Unfortunately, I get the following error when using Python 3:

C:\Anaconda3\lib\site-packages\sklearn\base.py:175: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead forest=forest.fit( args, varargs, kw, default = inspect.getargspec(init)

C:\Anaconda3\lib\site-packages\sklearn\base.py:175: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead args, varargs, kw, default = inspect.getargspec(init)

Does anyone know what this error means?

Upvotes: 1

Views: 430

Answers (1)

Dthal
Dthal

Reputation: 3316

It looks like getargspec was deprecated since Python 3.0(see getargspec doc), so you are getting warnings (not errors) when it gets called. It is used a lot in sklearn.

There is some discussion of this on the scikit-learn issue tracker. It was raised here and fixed here. It has been fixed for 0.17, the current stable release. If the warnings are a problem for you, you should probably just update your sklearn with conda update scikit-learn.

Upvotes: 2

Related Questions