Use a different value of k in top_k_categorical_accuracy
somnathrakshit opened this issue · comments
How can I use a different value of k in top_k_categorical_accuracy? Is is possible to change a parameter somewhere?
@somnathrakshit sorry, it's not easy. So the code that runs it is here, we use Keras metrics out of the box. This way, they don't support parametrizing K.
However you could define your own metric as specified here and pass it instead the one that is used right now. It would be a little bit more complicated though.
I think that is an important parameter to have in case the number of classes is low. (e.g. <= 5) It does not make any sense to have k=5 then. Maybe I'll submit a PR after implementing the custom metric in a few days.
@somnathrakshit yeah, we should finally build customisable metrics for Magpie, there's been requests of that already few times. We might want to be able to pass it through the external API i.e. magpie.train()
and pipe them all the way through up to the Keras call. If you have time, you can open a PR and I'll look at it!