Macro F1 Score for Each iteration

How to create “macro F1 score” metric for each iteration.

I build some code but it is evaluating according to per batches.

Can we use sklearn suggested macro F1 metric, Going through lots of discussion many people suggested not to use it as it is works according per batches.

NOTE : My target consists more that 3 classes so I needed Multi-class macro F1 score

Thanks in advance.

What do you mean by that?
Usually you can use sklearn metrics to observe your training.
Note that you cannot use them as a loss to calculate the gradients, but sklearn should be fine to calculate various metrics.

Hi @ptrblck

So my dataset contains 100 records and I need to run for 5 epoch and my batch size are 20.So if I use Macro F1 score using sklearn it give me f1 score after every batch (batch_1 = a(F1 Macro score),batch_2=b,… and batch_5=e) and my macro f1 score for epoch 1 is calculated by averages of 5 batches (a+b+…+e/5).

I read through some discussion pages related to keras which tells me above is not the best approach so keras remove macro f1 metrics now,

I am new to data science and pytorch just need to know is this the same problem for pytorch.

Hope and make you understand.Also I am attaching a link of stackoverflow/github discussion.