Skip to content

Instantly share code, notes, and snippets.

@Atlas7
Last active September 11, 2017 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Atlas7/255d91931d0f5d66c03b0d5c4362107f to your computer and use it in GitHub Desktop.
Save Atlas7/255d91931d0f5d66c03b0d5c4362107f to your computer and use it in GitHub Desktop.
Prediction accuracy computation

Q: how the following two differ, in the computation of prediction accuracy? (note: Y = true label, Y_preduction = predicted label).

(from deeplearning.ai, programming assignment. Course 1 - deep learning and neural network.)

Option 1 - Logistric Regression (Week 2):

print("Test accuracy: {} %".format(100 - np.mean(np.abs(Y_prediction - Y)) * 100))

Option 2 - Planar data classification (Week 3):

print('Accuracy of logistic regression: %d ' % float((np.dot(Y, Y_prediction) + np.dot(1-Y,1-Y_prediction))/float(Y.size)*100) +
       '% ' + "(percentage of correctly labelled datapoints)")

My guess: option 2 is able to handle multi classification. (e.g. class = 0, 1, 2, 3, 4 etc), where option 1 only two class (0, 1). Needs validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment