Hello everybody,
I am trying to use the measures
methods in MLJ
to evaluate binary classifications
I basically have integer vectors of 0 and 1 for ground truth (gt
from now on) and predictions (pred
from now on).
When I try to use confusion_matrix
using the integer vectors I get an error similar to the one described in this post.
The problem is almost solved when I provide vectors of Strings use categorical
to convert them.
Following is a toy example:
using MLJ
predStr = ["fast", "fast", "slow"];
gtStr = ["slow", "fast", "slow"];
cmtx = confusion_matrix(categorical(gtStr), categorical(predStr))
β Warning: The classes are un-ordered,
β using: negative='fast' and positive='slow'.
β To suppress this warning, consider coercing to OrderedFactor.
β @ MLJBase ~/.julia/packages/MLJBase/7hkEm/src/measures/confusion_matrix.jl:96
βββββββββββββββββββββββββββββ
β Ground Truth β
βββββββββββββββΌββββββββββββββ¬ββββββββββββββ€
β Predicted β fast β slow β
βββββββββββββββΌββββββββββββββΌββββββββββββββ€
β fast β 1 β 0 β
βββββββββββββββΌββββββββββββββΌββββββββββββββ€
β slow β 1 β 1 β
βββββββββββββββ΄ββββββββββββββ΄ββββββββββββββ
For the specific case above I would like to know order the classes and suppress the warning.
In general I would like to know there is a general way to provide input to the methods in measures
in the MLJ
package.
So far, using the categorical
function seem to work but would love to hear your opinion.
Thanks a lot for being such a great community!