• 10

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

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.

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).

  • 32
Reply Report

I arrived here with the v0.17 problem too. I found a solution using pip here, namely

    pip install git+https://github.com/scikit-learn/scikit-learn.git

I had to execute pip install cython first though.

However, that installs 0.19.dev0 (currently), but pip list indicates that the latest is 0.18rc2. Rather

    pip install scikit-learn==0.18.rc2

resolved the issue more satisfactorily.

  • 5
Reply Report
apt-get update; \
apt-get install -y python python-pip \
                    python-numpy \
                    python-scipy \
                    build-essential \
                    python-dev \
                    python-setuptools \
                    libatlas-dev \

update-alternatives --set libblas.so.3 /usr/lib/atlas-base/atlas/libblas.so.3; update-alternatives --set liblapack.so.3 /usr/lib/atlas-base/atlas/liblapack.so.3

pip install -U scikit-learn

I have imported MLPClassifier from sklearn.neural_network and it does seem to work.

You could also handle this issues by using docker images. This allows any developer to recreate the environment in any server within a single minute. You can pull the image from here

This can also be performed very easily using the datmo-cli tool. We faced these problems ourselves and decided to build it.

You could also solve this with one click using Datmo Disclaimer: I work at Datmo

  • 1
Reply Report

Trending Tags