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 ----------------------------------------------------------------------------------------------------
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@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@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/
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@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@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@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@python.org https://mail.python.org/mailman/listinfo/scikit-learn
you can use the LabelEncoder then. It will encode the classes for you. On Thu, 1 Aug 2019 at 23:04, Malik Yousef <malik.yousef@gmail.com> wrote:
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@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@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@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@python.org https://mail.python.org/mailman/listinfo/scikit-learn
_______________________________________________ scikit-learn mailing list scikit-learn@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/
Can you give me an example? --------------------------------------------------------------------------------------- *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 5:15 PM Guillaume Lemaître <g.lemaitre58@gmail.com> wrote:
you can use the LabelEncoder then. It will encode the classes for you.
On Thu, 1 Aug 2019 at 23:04, Malik Yousef <malik.yousef@gmail.com> wrote:
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@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@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@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@python.org https://mail.python.org/mailman/listinfo/scikit-learn
_______________________________________________ scikit-learn mailing list scikit-learn@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@python.org https://mail.python.org/mailman/listinfo/scikit-learn
Or use scoring=make_scorer(f1_score, pos_label='n.pre') On Fri, 2 Aug 2019 at 06:15, Malik Yousef <malik.yousef@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@python.org https://mail.python.org/mailman/listinfo/scikit-learn
Thanks for your reply. How I can set the name of the positive class in LinearSVC() for a two-class problem that when using the prediction then I will get positive scores fro that positive class? Malik --------------------------------------------------------------------------------------- *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 8:43 PM Joel Nothman <joel.nothman@gmail.com> wrote:
Or use scoring=make_scorer(f1_score, pos_label='n.pre')
On Fri, 2 Aug 2019 at 06:15, Malik Yousef <malik.yousef@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@python.org https://mail.python.org/mailman/listinfo/scikit-learn
_______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
participants (3)
-
Guillaume Lemaître -
Joel Nothman -
Malik Yousef