bias error in machine learning code example
Example: mean bias error
def MBE(y_true, y_pred):
'''
Parameters:
y_true (array): Array of observed values
y_pred (array): Array of prediction values
Returns:
mbe (float): Biais score
'''
y_true = np.array(y_true)
y_pred = np.array(y_pred)
y_true = y_true.reshape(len(y_true),1)
y_pred = y_pred.reshape(len(y_pred),1)
diff = (y_true-y_pred)
mbe = diff.mean()
print('MBE = ', mbe)