Added Multilayer Perceptron (sklearn) (#1609)

* Added Multilayer Perceptron ( sklearn)

* Rename MLPClassifier.py to multilayer_preceptron_classifier.py

* Rename multilayer_preceptron_classifier.py to multilayer_perceptron_classifier.py

* Update multilayer_perceptron_classifier.py
This commit is contained in:
QuantumNovice 2019-12-03 16:17:42 +05:00 committed by Christian Clauss
parent 8ffc4f8706
commit caad74466a

View File

@ -0,0 +1,30 @@
from sklearn.neural_network import MLPClassifier
X = [[0.0, 0.0], [1.0, 1.0], [1.0, 0.0], [0.0, 1.0]]
y = [0, 1, 0, 0]
clf = MLPClassifier(
solver="lbfgs", alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1
)
clf.fit(X, y)
test = [[0.0, 0.0], [0.0, 1.0], [1.0, 1.0]]
Y = clf.predict(test)
def wrapper(Y):
"""
>>> wrapper(Y)
[0, 0, 1]
"""
return list(Y)
if __name__ == "__main__":
import doctest
doctest.testmod()