Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SKlearn import MLPClassifier fails

I am trying to use the multilayer perceptron from scikit-learn in python. My problem is, that the import is not working. All other modules from scikit-learn are working fine.

from sklearn.neural_network import MLPClassifier 

Import Error: cannot import name MLPClassifier

I'm using the Python Environment Python64-bit 3.4 in Visual Studio 2015. I installed sklearn over the console with: conda install scikit-learn I also installed numpy and pandas. After I had the error above I also installed scikit-neuralnetwork with: pip install scikit-neuralnetwork The installed scikit-learn version is 0.17.

What have I done wrong? Am I missing an installation?

----- EDIT ----

In addition to the answer of tttthomasssss, I found the solution on how to install the sknn library for neuronal networks. I followed this tutorial. Do the following steps:

  • pip install scikit-neuralnetwork
  • download and install the GCC compiler
  • install mingw with conda install mingw libpython

You can use the sknn library after.

like image 207
maniac Avatar asked Dec 01 '15 08:12

maniac


People also ask

What is Max ITER in MLPClassifier?

max_iter: It denotes the number of epochs. activation: The activation function for the hidden layers. solver: This parameter specifies the algorithm for weight optimization across the nodes.

What is Max_iter in MLP?

max_iterint, default=200. Maximum number of iterations. The solver iterates until convergence (determined by 'tol') or this number of iterations. For stochastic solvers ('sgd', 'adam'), note that this determines the number of epochs (how many times each data point will be used), not the number of gradient steps.

Is Scikit learn Neural Network?

Yes, with Scikit-Learn, you can create neural network with these three lines of code, which all handles much of the leg work for you. Let's see what is happening in the above script. The first step is to import the MLPClassifier class from the sklearn. neural_network library.


1 Answers

MLPClassifier is not yet available in scikit-learn v0.17 (as of 1 Dec 2015). If you really want to use it you could clone 0.18dev (however, I don't know how stable this branch currently is).

like image 170
tttthomasssss Avatar answered Oct 02 '22 20:10

tttthomasssss