| 8 | } |
| 9 | |
| 10 | float_type Accuracy::score(const vector<float_type> &predict_y, const vector<float_type> &ground_truth_y) { |
| 11 | int n_correct = 0; |
| 12 | for (int i = 0; i < predict_y.size(); ++i) { |
| 13 | if (predict_y[i] == ground_truth_y[i]) |
| 14 | n_correct++; |
| 15 | } |
| 16 | float accuracy = n_correct / (float) ground_truth_y.size(); |
| 17 | return accuracy; |
| 18 | } |
| 19 | |
| 20 | string MSE::name() { |
| 21 | return "Mean Squared Error"; |