9951 explained code solutions for 126 technologies


python-scikit-learnNeural network example


from sklearn import neural_network

X = [[0., 0.], [1., 1.]]
y = [0, 1]

nn = neural_network.MLPClassifier(solver='lbfgs')
nn.fit(X, y)

y_pred = nn.predict(X)ctrl + c
from sklearn import

import module from scikit-learn

.MLPClassifier(

creates multi-layer perceptron neural network model

.fit(

train transformation model

.predict(

predict target variable based on given features dataset


Usage example

from sklearn import neural_network
X = [[0., 0.], [1., 1.]]
y = [0, 1]
nn = neural_network.MLPClassifier(solver='lbfgs')
nn.fit(X, y)

print(nn.predict(X))
output
[0 1]

Related