Merge pull request #210 from himangSharatun/master

add mean bias deviation in scoring functions
This commit is contained in:
Harshil 2017-11-28 17:07:07 +05:30 committed by GitHub
commit 777d947325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

19
machine_learning/scoring_functions.py Normal file → Executable file
View File

@ -1,4 +1,4 @@
import numpy
import numpy as np
""" Here I implemented the scoring functions.
MAE, MSE, RMSE, RMSLE are included.
@ -41,7 +41,7 @@ def rmse(predict, actual):
actual = np.array(actual)
difference = predict - actual
square_diff = np.square(dfference)
square_diff = np.square(difference)
mean_square_diff = square_diff.mean()
score = np.sqrt(mean_square_diff)
return score
@ -61,3 +61,18 @@ def rmsle(predict, actual):
score = np.sqrt(mean_square_diff)
return score
#Mean Bias Deviation
def mbd(predict, actual):
predict = np.array(predict)
actual = np.array(actual)
difference = predict - actual
numerator = np.sum(difference) / len(predict)
denumerator = np.sum(actual) / len(predict)
print str(numerator)
print str(denumerator)
score = float(numerator) / denumerator * 100
return score