nok / sklearn-porter

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SVC predict_proba not supported

IslamSabdelazez opened this issue · comments

when i try to export "porter = Porter(model, language='java', method= 'predict_proba')" from SVC model it returns "Currently the chosen model method 'predict_proba' isn't supported." is there any solution to get the probability of the predicted class ?!

Sorry, not today, this feature is work in progress.

When will you release this feature? I need this, too.

Any new updates? on this feature.

Hello @KMKnation , yes, the adaption of all listed estimators is still in progress.

The estimator sklearn.svm.SVC doesn't support the computation of the class probabilities. There is no predict_proba mehtod. Because of that there will be no implementation in sklearn-porter.

Hi Nok,

Thanks for the project.

I think sklearn.svm.SVC is supporting class probabilities, as shown in this link:

https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html#sklearn.svm.SVC.predict_proba

I wonder if you can include it :-)

This feature is much required please update.

I needed the same thing for RandomForestClassifier, I changed the last part of code (in my case, js code):

this.predict = function(features) {
        var classes = new Array(3).fill(0);
        for (var i = 0; i < trees.length; i++) {
            classes[trees[i](features)]++;
        }
        return findMax(classes);
}

to:

this.predict = function(features) {
        var classes = new Array(3).fill(0);
        for (var i = 0; i < trees.length; i++) {
            classes[trees[i](features)]++;
        }
        return classes;
}

But I don't know if it works with svm or not.