sklearn-porter icon indicating copy to clipboard operation
sklearn-porter copied to clipboard

Multilabel prediction

Open DerMajeed opened this issue 5 years ago • 3 comments

I am trying to use the Sklearn Porter to transform my multilabel randomforest Classifier into Javascript. But the transformed Classifier doesn't predict multiple label.

Does the Sklearn Porter support multilabel prediction? If yes, could you please provide a small example of the implementation?

DerMajeed avatar May 14 '19 18:05 DerMajeed

The JS example itself is using multilabel with 3 different labels. So I assume that this should work.

What are the labels you are using? There are known problems when using labels that are non-sequential ints, e.g. labels [0,1,3] instead of [0,1,2] (#37)

skjerns avatar May 15 '19 11:05 skjerns

First of all, thanks for your response! I am using binary labels, so as a prediction I should get a list of true/false for each label.

For example:

[0,1,1,0,0,0,0,1,0]	

This prediction i mapping back to the string labels.

PS: I don't know, if you understood my problem right. I don't want to predict one label out of multiple possible label (like in the iris dataset example you provided). I want to predict multiple labels out of all of possible labels.

DerMajeed avatar May 15 '19 15:05 DerMajeed

Ah, I mixed up multiclass and multilabel.

I do assume that this is not implemented yet, it also doesn't work when porting to other languages.

You might be able to work-around with splitting each label up into it's own binary classification RFC. However, this will only work satisfactory if the labels are assumed to be independent (which is most likely not the case).

skjerns avatar May 16 '19 07:05 skjerns