mean bias error

Solutions on MaxInterview for mean bias error by the best coders in the world

showing results for - "mean bias error"
Enrico
10 Mar 2018
1def MBE(y_true, y_pred):
2    '''
3    Parameters:
4        y_true (array): Array of observed values
5        y_pred (array): Array of prediction values
6
7    Returns:
8        mbe (float): Biais score
9    '''
10    y_true = np.array(y_true)
11    y_pred = np.array(y_pred)
12    y_true = y_true.reshape(len(y_true),1)
13    y_pred = y_pred.reshape(len(y_pred),1)   
14    diff = (y_true-y_pred)
15    mbe = diff.mean()
16    print('MBE = ', mbe)