Hi Carlos,

take a look at the species distribution example [1].

Summary: Use ``OneClassSVM.decision_function`` - you don't necessarily need
probabilities for ROC/AUC - confidence values are fine.

best,
 Peter

[1]
http://scikit-learn.org/stable/auto_examples/applications/plot_species_distribution_modeling.html#example-applications-plot-species-distribution-modeling-py



2013/5/7 <[email protected]>

> OK, thank you. I will do it in that way
>
> Carlos
>
> Quoting [email protected]:
>
> > Today's Topics:
> >
> >    1. Re: ROC for OneClassSVM (Andreas Mueller)
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Mon, 06 May 2013 12:33:03 +0200
> > From: Andreas Mueller <[email protected]>
> > Subject: Re: [Scikit-learn-general] ROC for OneClassSVM
> > To: [email protected]
> > Message-ID: <[email protected]>
> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> >
> > On 05/06/2013 12:27 PM, [email protected] wrote:
> >> Hello,
> >>
> >>    I would like to use OneClassSVM for novelty detection. I have some
> >> 'normal' data for fitting the classifier. Then I have 'normal' and
> >> 'abnormal' data for testing the performance.
> >>
> >>    I would like to use the area under the ROC curve as the figure of
> >> merit of the detector. The function roc_curve needs the predicted
> >> probability. I have read that the probability can be obtained if the
> >> classifier is obtained with the parameter probability = True. However,
> >> I get an error when I try to pass this parameter.
> >>
> >>    I am using version 0.10 of sklearn.
> >>
> >>    For instance:
> >>
> >>    import sklearn
> >>    import sklearn.metrics
> >>    import scipy
> >>    import sklearn.svm
> >>
> >>    X = scipy.random.randn(100, 2)
> >>
> >>    X_train = scipy.r_[X + 2, X - 2]
> >>
> >>    clf = sklearn.svm.OneClassSVM(nu=0.1, kernel="rbf", gamma=0.1,
> >> probability=True)
> >>
> >>    Then I get an error. I have also tried
> >>
> >>    clf = sklearn.svm.OneClassSVM(nu=0.1, kernel="rbf", gamma=0.1)
> >>    clf.fit(X_train, probability=True)
> >>
> >>    but it is again an error.
> >>
> >>    Is that option available for OneClassSVM? If not, how could I draw
> >> the ROC? Could I sweep a threshold on the distance to the hyperplane
> >> given by clf.decision_function?
> >>
> > Yes, I think this is what you should do.
> > Hth,
> > Andy
> >
> >
>
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and
> their applications. This 200-page book is written by three acclaimed
> leaders in the field. The early access version is available now.
> Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
> _______________________________________________
> Scikit-learn-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>



-- 
Peter Prettenhofer
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to