nok / sklearn-porter

Transpile trained scikit-learn estimators to C, Java, JavaScript and others.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multilabel prediction

DerMajeed opened this issue · 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?

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)

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.

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).