MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / classification_rate

Function classification_rate

ann_class/forwardprop.py:53–60  ·  view source on GitHub ↗
(Y, P)

Source from the content-addressed store, hash-verified

51# determine the classification rate
52# num correct / num total
53def classification_rate(Y, P):
54 n_correct = 0
55 n_total = 0
56 for i in range(len(Y)):
57 n_total += 1
58 if Y[i] == P[i]:
59 n_correct += 1
60 return float(n_correct) / n_total
61
62P_Y_given_X = forward(X, W1, b1, W2, b2)
63P = np.argmax(P_Y_given_X, axis=1)

Callers 1

forwardprop.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected