[scikit-learn] Probability values from OneClassSVM

Nicolas Goix goix.nicolas at gmail.com
Mon Jun 6 20:11:51 EDT 2016


Hi Mamun,

from sklearn.metrics import roc_curve, auc
from sklearn.svm import OneClassSVM

ocsvm = OneClassSVM().fit(X_train)
scoring = - ocsvm.decision_function(X_test)  # the lower, the more normal
fpr, tpr, thresholds = roc_curve(y_test, scoring)
AUC = auc(fpr, tpr)

HTH
Nicolas

2016-06-06 19:21 GMT-04:00 Mamun Rashid <mamunbabu2001 at gmail.com>:

> Hi Nicolas,
> Thanks for your reply. Apology for the naive question.
> I can see from the example that we can plot the decision boundary using
> the decision function.
> Not sure how can I extract the ROC and PRC metric from there. A small
> example would greatly help.
>
> Thanks,
> Mamun
>
> On 3 Jun 2016, at 17:16, Nicolas Goix <goix.nicolas at gmail.com> wrote:
>
> Hi Mamun,
> You can draw ROC and PR curves using the OCSVM decision_function
> Nicolas
>
> 2016-06-03 11:54 GMT-04:00 Mamun Rashid <mamunbabu2001 at gmail.com>:
>
>> Hi everyone,
>> I am running OneClassSVM method. It seems unlike the normal SVC, which
>> has an option to return probability, this method does not have any option
>> to retrieve probability values.
>> I would like to draw some performance metric such as the ROC and
>> Precision Recall about the performance of the classifier.
>>
>> Thanks,
>> Mamun
>> _______________________________________________
>> scikit-learn mailing list
>> scikit-learn at python.org
>> https://mail.python.org/mailman/listinfo/scikit-learn
>>
>
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
>
>
>
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20160606/2111abbf/attachment.html>


More information about the scikit-learn mailing list