[scikit-learn] scikit-learn Digest, Vol 41, Issue 2

Maiia Bakhova myabakhova at gmail.com
Sun Aug 4 15:27:09 EDT 2019


You probably can use LabelEncoder with OneHotEncoder from
sklearn.preprocessing to convert your string data into numerical.
Best,
Mya

On Thu, Aug 1, 2019 at 2:02 PM <scikit-learn-request at python.org> wrote:

> Send scikit-learn mailing list submissions to
>         scikit-learn at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mail.python.org/mailman/listinfo/scikit-learn
> or, via email, send a message with subject or body 'help' to
>         scikit-learn-request at python.org
>
> You can reach the person managing the list at
>         scikit-learn-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of scikit-learn digest..."
>
>
> Today's Topics:
>
>    1. SVM-RFE with scoring = 'f1' (Malik Yousef)
>    2. Re: SVM-RFE with scoring = 'f1' (Guillaume Lema?tre)
>    3. Re: SVM-RFE with scoring = 'f1' (Malik Yousef)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 1 Aug 2019 16:10:26 -0400
> From: Malik Yousef <malik.yousef at gmail.com>
> To: scikit-learn at python.org
> Subject: [scikit-learn] SVM-RFE with scoring = 'f1'
> Message-ID:
>         <CACXKj+QQ9kZ-Q6PhwU+bQpxyBN-NOzmzjsBYCgW=
> LvS+C7X_Zw at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> 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
>
> ----------------------------------------------------------------------------------------------------
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.python.org/pipermail/scikit-learn/attachments/20190801/20fbb5fc/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Thu, 1 Aug 2019 22:56:24 +0200
> From: Guillaume Lema?tre <g.lemaitre58 at gmail.com>
> To: Scikit-learn mailing list <scikit-learn at python.org>
> Subject: Re: [scikit-learn] SVM-RFE with scoring = 'f1'
> Message-ID:
>         <
> CACDxx9iN3qvuaJtXbAJPem4gZFviLVqTeoLU203gRz0_UA2Y_g at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> It looks like your data contains string. You need to make some
> preprocessing before to give it the linear model.
>
> On Thu, 1 Aug 2019 at 22:16, 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
> >
>
>
> --
> Guillaume Lemaitre
> INRIA Saclay - Parietal team
> Center for Data Science Paris-Saclay
> https://glemaitre.github.io/
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.python.org/pipermail/scikit-learn/attachments/20190801/5ed63ff1/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 3
> Date: Thu, 1 Aug 2019 17:02:24 -0400
> From: Malik Yousef <malik.yousef at gmail.com>
> To: Scikit-learn mailing list <scikit-learn at python.org>
> Subject: Re: [scikit-learn] SVM-RFE with scoring = 'f1'
> Message-ID:
>         <CACXKj+S=
> vyFBR0v0QuGr9g9NuzOrXGV1BFiOihAH6Dt4SvYwtQ at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> The only string column is the label column(class labels, n.pre, and c.pre).
> if the scoring = 'accuracy' then it works fine.
> So I think I need somehow to set up the postive_lable.. that I don't know
> how to do that.
>
>
> ---------------------------------------------------------------------------------------
> *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
>
> ----------------------------------------------------------------------------------------------------
>
>
> On Thu, Aug 1, 2019 at 4:58 PM Guillaume Lema?tre <g.lemaitre58 at gmail.com>
> wrote:
>
> > It looks like your data contains string. You need to make some
> > preprocessing before to give it the linear model.
> >
> > On Thu, 1 Aug 2019 at 22:16, 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
> >>
> >
> >
> > --
> > Guillaume Lemaitre
> > INRIA Saclay - Parietal team
> > Center for Data Science Paris-Saclay
> > https://glemaitre.github.io/
> > _______________________________________________
> > 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/20190801/650411b8/attachment.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
>
>
> ------------------------------
>
> End of scikit-learn Digest, Vol 41, Issue 2
> *******************************************
>


-- 
Maiia Bakhova
 Mathematician in Data Science <http://myabakhova.blogspot.com/>
https://www.linkedin.com/in/myabakhova
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20190804/04c1fb6e/attachment.html>


More information about the scikit-learn mailing list