Skip to content

Commit 14fa3d1

Browse files
authored
Fix wrapper function to return list of predictions
Added return statement to wrapper function for proper output.
1 parent cc5dff2 commit 14fa3d1

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎machine_learning/multilayer_perceptron_classifier.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
X = [[0.0, 0.0], [1.0, 1.0], [1.0, 0.0], [0.0, 1.0]]
44
y = [0, 1, 0, 0]
55

6+
67
clf = MLPClassifier(
78
solver="lbfgs", alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1
89
)
910

1011
clf.fit(X, y)
1112

13+
1214
test = [[0.0, 0.0], [0.0, 1.0], [1.0, 1.0]]
1315
Y = clf.predict(test)
1416

@@ -18,7 +20,7 @@ def wrapper(y):
1820
>>> [int(x) for x in wrapper(Y)]
1921
[0, 0, 1]
2022
"""
21-
23+
return list(y)
2224

2325
if __name__ == "__main__":
2426
import doctest

0 commit comments

Comments
 (0)