TransWikia.com

Enable to reproduce the loss of training while predicting

Data Science Asked by TARBOUN on June 1, 2021

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.

One Answer

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

Answered by TARBOUN on June 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP