Skip to content

Instantly share code, notes, and snippets.

@gkhayes
Created January 23, 2019 06:41
Show Gist options
  • Save gkhayes/0505fe31612acc6bc29bb60c6215f374 to your computer and use it in GitHub Desktop.
Save gkhayes/0505fe31612acc6bc29bb60c6215f374 to your computer and use it in GitHub Desktop.
Make predictions from neural network fitted to Iris dataset
from sklearn.metrics import accuracy_score
# Predict labels for train set and assess accuracy
y_train_pred = nn_model1.predict(X_train_scaled)
y_train_accuracy = accuracy_score(y_train_hot, y_train_pred)
print('Training accuracy: ', y_train_accuracy)
# Predict labels for test set and assess accuracy
y_test_pred = nn_model1.predict(X_test_scaled)
y_test_accuracy = accuracy_score(y_test_hot, y_test_pred)
print('Test accuracy: ', y_test_accuracy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment