-1

i use CNN model for a regression problem with a custom loss

def loss_M2(y_true,y_pred):
    y_true_f=K.flatten(y_true)
    y_pred_f=K.flatten(y_pred)
    M2=K.max(K.abs(K.cumsum((y_pred_f-y_true_f),axis=0)))        
    return M2

enter image description here ISSUE : when i call y_train_predict = model.predict(X_train, verbose=0) and evalaute the loss i get "926" instead of something close to 200 that we see on the image above , here is the numpy function that compute the same custom loss

def score_M2(reel,pred):
    return max(abs(np.cumsum(reel-pred)))

PS : i checked that the loss_M2 and score_M2 give the same results for the same inputs. Please tell me what is happening here.

1 Answers1

0
y_pred
[ 93.361     10.397      5.515    206.093     24.379     44.883
  26.64       4.708      6.525      4.112704]
y_true
[74.32183, 49.488754, 39.4487, 218.02928, 25.579964, 22.995552, 17.774035, 1.858181, 3.0018008, 4.594691]

enter image description here

Yes my data are normalized i made sure that what i give to my predict function is the same

  • I assume you are also normalizing the data when predicting. Also, if you are using dropout, it has to be disabled in the predicting stage... I encourage to give more info about the network, the procedure you follow and so son... let's see if other users can figure out what's going out. – ignatius Dec 05 '18 at 16:17