in this line I used y_true and y_pred:
model.compile(optimizer="rmsprop", loss="categorical_crossentropy", metrics=[precision(y_true,y_pred),recall(y_true,y_pred),fmeasure(y_true,y_pred)])
but a this error happened:
NameError: name 'y_true' is not defined
and I imported metrics
from keras import metrics
When specifying metrics, you pass function objects to the metrics parameter, not function calls. There is no need at all to mention y_true
and y_pred
:
model.compile(optimizer="rmsprop", loss="categorical_crossentropy", metrics=[precision, recall, fmeasure])