(Y, P)
| 25 | # determine the classification rate |
| 26 | # num correct / num total |
| 27 | def classification_rate(Y, P): |
| 28 | n_correct = 0 |
| 29 | n_total = 0 |
| 30 | for i in range(len(Y)): |
| 31 | n_total += 1 |
| 32 | if Y[i] == P[i]: |
| 33 | n_correct += 1 |
| 34 | return float(n_correct) / n_total |
| 35 | |
| 36 | |
| 37 | def derivative_w2(Z, T, Y): |