[scikit-learn] question about using sklearn.neural_network.MLPClassifier?
linjia at ruijie.com.cn
linjia at ruijie.com.cn
Wed Nov 23 04:27:28 EST 2016
Hi everyone
I try to use sklearn.neural_network.MLPClassifier to test the XOR operation, but I found the result is not satisfied. The following is code, can you tell me if I use the lib incorrectly?
from sklearn.neural_network import MLPClassifier
X = [[0, 0], [0, 1], [1, 0], [1, 1]]
y = [0, 1, 1, 0]
clf = MLPClassifier(solver='adam', activation='logistic', alpha=1e-3, hidden_layer_sizes=(2,), max_iter=1000)
clf.fit(X, y)
res = clf.predict([[0, 0], [0, 1], [1, 0], [1, 1]])
print(res)
#result is [0 0 0 0], score is 0.5
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20161123/bfa1af28/attachment.html>
More information about the scikit-learn
mailing list