[scikit-learn] SVM-RFE with scoring = 'f1'

Joel Nothman joel.nothman at gmail.com
Thu Aug 1 20:41:21 EDT 2019


Or use scoring=make_scorer(f1_score, pos_label='n.pre')

On Fri, 2 Aug 2019 at 06:15, Malik Yousef <malik.yousef at gmail.com> wrote:

> Hello
> When in using the scoring to be 'f1' then i get an error.
> Here is the code and the error
>
> X=data
> y=target_column
> classifier = LinearSVC()
> rfecv = RFECV(estimator=classifier, step=0.1,
> cv=StratifiedKFold(5),scoring='f1')
> rfecv.fit(X, y)
>
> The error is :
> ValueError: pos_label=1 is not a valid label: array([u'c.pre', u'n.pre'],
> dtype='<U5')
>
> Please your help
> (I'm new to using scikit-leanr)
>
> ---------------------------------------------------------------------------------------
> *Prof. Malik Yousef , Associate Professor                           *
> *Zefat Academic College , Department of Information System  *
> Home Page:
> https://malikyousef.com/
> Google Scholar Profile :
> https://scholar.google.com/citations?user=9UCZ_q4AAAAJ&hl=en&oi=ao
>
> ----------------------------------------------------------------------------------------------------
> _______________________________________________
> 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/20190802/3bac464f/attachment.html>


More information about the scikit-learn mailing list