Return sum of square error for error calculation :param predicted_y : contains the output of prediction (result vector) :param original_y : contains values of expected outcome :return : mean absolute error computed from given feature's >>> predicted_y = [3, -0.5, 2, 7]
(predicted_y, original_y)
| 111 | |
| 112 | |
| 113 | def mean_absolute_error(predicted_y, original_y): |
| 114 | """Return sum of square error for error calculation |
| 115 | :param predicted_y : contains the output of prediction (result vector) |
| 116 | :param original_y : contains values of expected outcome |
| 117 | :return : mean absolute error computed from given feature's |
| 118 | |
| 119 | >>> predicted_y = [3, -0.5, 2, 7] |
| 120 | >>> original_y = [2.5, 0.0, 2, 8] |
| 121 | >>> mean_absolute_error(predicted_y, original_y) |
| 122 | 0.5 |
| 123 | """ |
| 124 | total = sum(abs(y - predicted_y[i]) for i, y in enumerate(original_y)) |
| 125 | return total / len(original_y) |
| 126 | |
| 127 | |
| 128 | def main(): |
nothing calls this directly
no outgoing calls
no test coverage detected