Categories
Misc

How to fix "NoneType object is not callable" in Keras model?

The code works perfectly fine if I don’t include my custom accuracy metric function. Can someone tell the fix for the same?

Accuracy Metric Function

def get_multiaccuracy(y_true, y_pred): total_labels = 0 correct_labels = 0 for i, val in enumerate(y_true): if val == 1: total_labels += 1 if y_pred[i] == 1: correct_labels += 1 for i, val in enumerate(y_pred): if val == 1: if y_true[i] != 1: total_labels += 1 return correct_labels/total_labels 

Model Compiler

model.compile(optimizer = 'adam', loss='binary_crossentropy',metrics=[get_multiaccuracy]) 

submitted by /u/ChaosAdm
[visit reddit] [comments]

Leave a Reply

Your email address will not be published. Required fields are marked *