Skip to content

Commit caad744

Browse files
QuantumNovicecclauss
authored andcommitted
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
1 parent 8ffc4f8 commit caad744

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from sklearn.neural_network import MLPClassifier
2+
3+
4+
X = [[0.0, 0.0], [1.0, 1.0], [1.0, 0.0], [0.0, 1.0]]
5+
y = [0, 1, 0, 0]
6+
7+
8+
clf = MLPClassifier(
9+
solver="lbfgs", alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1
10+
)
11+
12+
clf.fit(X, y)
13+
14+
15+
test = [[0.0, 0.0], [0.0, 1.0], [1.0, 1.0]]
16+
Y = clf.predict(test)
17+
18+
19+
def wrapper(Y):
20+
"""
21+
>>> wrapper(Y)
22+
[0, 0, 1]
23+
"""
24+
return list(Y)
25+
26+
27+
if __name__ == "__main__":
28+
import doctest
29+
30+
doctest.testmod()

0 commit comments

Comments
 (0)