Metric F1 score macro on classification ( single label multiclass )

F1Score needs to be instantiated.

It looks like a function but is actually a class and needs to be
instantiated. F1Score is a class based on the skm_to_fastai
functions which returns a Class object (AccumMetric). AccumMetric
has function __call__ which basically allows you to call the
object as a function

So It will be:

f1_score_multi = F1Score(average="macro") ## convert class to functie
learn = cnn_learner(dls,resnet18,metrics=f1_score_multi)
1 Like