This value is Negative, if the model underpredicts, positive, if it overpredicts. Example(rounded for precision): Here the model overpredicts >>> actual = [1,2,3];predict = [2,3,4] >>> float(np.around(mbd(predict,actual),decimals = 2)) 50.0 Here the model underpre
(predict, actual)
| 107 | |
| 108 | # Mean Bias Deviation |
| 109 | def mbd(predict, actual): |
| 110 | """ |
| 111 | This value is Negative, if the model underpredicts, |
| 112 | positive, if it overpredicts. |
| 113 | |
| 114 | Example(rounded for precision): |
| 115 | |
| 116 | Here the model overpredicts |
| 117 | >>> actual = [1,2,3];predict = [2,3,4] |
| 118 | >>> float(np.around(mbd(predict,actual),decimals = 2)) |
| 119 | 50.0 |
| 120 | |
| 121 | Here the model underpredicts |
| 122 | >>> actual = [1,2,3];predict = [0,1,1] |
| 123 | >>> float(np.around(mbd(predict,actual),decimals = 2)) |
| 124 | -66.67 |
| 125 | """ |
| 126 | predict = np.array(predict) |
| 127 | actual = np.array(actual) |
| 128 | |
| 129 | difference = predict - actual |
| 130 | numerator = np.sum(difference) / len(predict) |
| 131 | denumerator = np.sum(actual) / len(predict) |
| 132 | # print(numerator, denumerator) |
| 133 | score = float(numerator) / denumerator * 100 |
| 134 | |
| 135 | return score |
| 136 | |
| 137 | |
| 138 | def manual_accuracy(predict, actual): |
nothing calls this directly
no outgoing calls
no test coverage detected