sklearn, for example, has built-in confusion matrix logic that might reduce some homegrown lines of code.
Maybe there's also something in sklearn or pandas that can replace some of the logic of score_matrix.
Besides logic itself, in both cases we're using raw Python data types of dicts with well-known keys. Maybe those libraries have more tightly-defined types we could pass around. Or maybe it's best to just make our own thin type wrapper to provide that tight definition.
sklearn, for example, has built-in confusion matrix logic that might reduce some homegrown lines of code.
Maybe there's also something in sklearn or pandas that can replace some of the logic of
score_matrix
.Besides logic itself, in both cases we're using raw Python data types of dicts with well-known keys. Maybe those libraries have more tightly-defined types we could pass around. Or maybe it's best to just make our own thin type wrapper to provide that tight definition.