Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

import check_arrays from sklearn

I'm trying to use a svm function from the scikit learn package for python but I get the error message:

from sklearn.utils.validation import check_arrays

ImportError: cannot import name 'check_arrays'

I'm using python 3.4. Can anyone give me an advice? Thanks in advance.

like image 868
rado Avatar asked Apr 13 '15 00:04

rado


People also ask

What is base estimator in sklearn?

BaseEstimator provides among other things a default implementation for the get_params and set_params methods, see [the source code]. This is useful to make the model grid search-able with GridSearchCV for automated parameters tuning and behave well with others when combined in a Pipeline .

What is fit in scikit-learn?

The scikit learn 'fit' method is one of those tools. The 'fit' method trains the algorithm on the training data, after the model is initialized. That's really all it does. So the sklearn fit method uses the training data as an input to train the machine learning model.

What does check_ array do?

Input validation on an array, list, sparse matrix or similar. By default, the input is checked to be a non-empty 2D array containing only finite values. If the dtype of the array is object, attempt converting to float, raising on failure.

How do I find my sklearn version?

Use sklearn. __version__ to display the installed version of scikit-learn. Call sklearn. __version__ to return the current version of scikit-learn .


1 Answers

This method was removed in 0.16, replaced by a (very different) check_array function. You are likely getting this error because you didn't upgrade from 0.15 to 0.16 properly. [Or because you relied on a not-really-public function in sklearn]. See http://scikit-learn.org/dev/install.html#canopy-and-anaconda-for-all-supported-platforms . If you installed using anaconda / conda, you should use the conda mechanism to upgrade, not pip. Otherwise old .pyc files might remain in your folder.

like image 109
Andreas Mueller Avatar answered Oct 22 '22 12:10

Andreas Mueller