added neural networks
This commit is contained in:
@@ -1200,6 +1200,21 @@ print("Test set accuracy with Logistic Regression for AND gate: {:.2f}".format(l
|
||||
|
||||
Not exactly impressive, but somewhat better.
|
||||
|
||||
!split
|
||||
===== Adding Neural Networks =====
|
||||
|
||||
!bc pycod
|
||||
|
||||
# and now neural networks with Scikit-Learn and the XOR
|
||||
|
||||
from sklearn.neural_network import MLPClassifier
|
||||
from sklearn.datasets import make_classification
|
||||
X, yXOR = make_classification(n_samples=100, random_state=1)
|
||||
FFNN = MLPClassifier(random_state=1, max_iter=300).fit(X, yXOR)
|
||||
FFNN.predict_proba(X)
|
||||
print(f"Test set accuracy with Feed Forward Neural Network for XOR gate:{FFNN.score(X, yXOR)}")
|
||||
|
||||
!ec
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user