Skip to content

enable to reproduce loss value of training when predicting CNN #334

@ztarboun

Description

@ztarboun

Hello,
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

1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions