I am tinkering on a package where I need these and I though these classes would be a better fit here.
I included the tests as well. If there is interest I will also adapt the documentation accordingly.
I included these encodings as wrappers around labelmap:
ZeroOneClassEncoding: {0,1}
SignedClassEncoding: {-1,1}
OneOfKClassEncoding: see below
MultinomialClassEncoding: {1:k}, or {0:k-1}
It allows you to do things like
t = ["y", "n", "k", "y"]
y = ["n", "y", "y", "k", "n"]
encoding = OneOfKClassEncoding(t)
pred = labelencode(encoding, y)
where the pred would end up being
@test pred ==
[0 1 0;
1 0 0;
1 0 0;
0 0 1;
0 1 0]
and of course labeldecode would bring you back to the input
I am tinkering on a package where I need these and I though these classes would be a better fit here. I included the tests as well. If there is interest I will also adapt the documentation accordingly.
I included these encodings as wrappers around labelmap:
ZeroOneClassEncoding
: {0,1}SignedClassEncoding
: {-1,1}OneOfKClassEncoding
: see belowMultinomialClassEncoding
: {1:k}, or {0:k-1}It allows you to do things like
where the
pred
would end up beingand of course
labeldecode
would bring you back to the inputlet me know what you think.