Last active
July 18, 2019 16:07
-
-
Save michelkana/93149b09b6be47e3658ba29422dfa725 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.models import Sequential | |
from keras.layers import Dense | |
from sklearn.metrics import accuracy_score | |
model = Sequential() | |
model.add(Dense(1, activation = 'sigmoid', input_dim = 1)) | |
model.compile(optimizer='sgd', loss='binary_crossentropy', metrics = ['acc']) | |
history = model.fit(x, y, batch_size=1, epochs=100, shuffle=True, verbose=0) | |
print("Classification accuracy: {0:0.2%}".format(accuracy_score(y, y_pred))) | |
plt.scatter(x,y, label='original data') | |
plt.scatter(x,y_pred, label='ANN prediction') | |
plt.xlabel('year') | |
plt.ylabel('harvest good/bad') | |
plt.title('classification') | |
plt.legend(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment