<div dir="ltr">I was able to solve the problem using - <div><br></div><div><span style="background-color:rgb(204,204,204)">mlb = MultiLabelBinarizer()</span></div><div><span style="background-color:rgb(204,204,204)">mlb.fit([y_train])</span></div><div><br></div><div>Thanks for the suggestions. The output of mlb.classes_ now looks the following (first ten classes):</div><div><img src="cid:ii_k0ho2wp00" alt="image.png" width="476" height="61"><br></div><div><br></div><div>However, when I transform it using <span style="background-color:rgb(204,204,204)">mlb.transform([y_train])</span>, another problem arrises - </div><div><br></div><div><div><img src="cid:ii_k0ho4viv1" alt="image.png" width="476" height="65"><br></div></div><div><br></div><div>Kindly suggest :)</div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><span style="color:rgb(85,85,85);font-family:sans-serif;border-width:2px 0px 0px;border-style:solid;border-color:rgb(213,15,37);padding-top:2px;margin-top:2px"><br></span><span style="color:rgb(85,85,85);font-family:sans-serif;border-width:2px 0px 0px;border-style:solid;border-color:rgb(213,15,37);padding-top:2px;margin-top:2px">Sayak Paul |</span><span style="color:rgb(85,85,85);font-family:sans-serif;border-width:2px 0px 0px;border-style:solid;border-color:rgb(51,105,232);padding-top:2px;margin-top:2px"> <a href="http://sayak.dev" target="_blank">sayak.dev</a></span><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 12, 2019 at 9:33 PM <<a href="mailto:scikit-learn-request@python.org">scikit-learn-request@python.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Send scikit-learn mailing list submissions to<br>
<a href="mailto:scikit-learn@python.org" target="_blank">scikit-learn@python.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/scikit-learn</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:scikit-learn-request@python.org" target="_blank">scikit-learn-request@python.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:scikit-learn-owner@python.org" target="_blank">scikit-learn-owner@python.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of scikit-learn digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re: MultiLabelBinarizer gives individual characters instead<br>
of the classes (Lo?c Est?ve)<br>
2. Re: Vote on SLEP009: keyword only arguments (Guillaume Lema?tre)<br>
3. How can I enable line tracing for cython modules.<br>
(Alejandro Javier Peralta Frias)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Thu, 12 Sep 2019 07:24:48 +0200<br>
From: Lo?c Est?ve <<a href="mailto:loic.esteve@ymail.com" target="_blank">loic.esteve@ymail.com</a>><br>
To: Scikit-learn mailing list <<a href="mailto:scikit-learn@python.org" target="_blank">scikit-learn@python.org</a>><br>
Subject: Re: [scikit-learn] MultiLabelBinarizer gives individual<br>
characters instead of the classes<br>
Message-ID: <<a href="mailto:vnokwoeeozmn.fsf@ymail.com" target="_blank">vnokwoeeozmn.fsf@ymail.com</a>><br>
Content-Type: text/plain; charset=utf-8<br>
<br>
I think this caveat has been added in the dev doc (not yet in the stable<br>
doc). You may want to read:<br>
<a href="https://scikit-learn.org/dev/modules/generated/sklearn.preprocessing.MultiLabelBinarizer.html" rel="noreferrer" target="_blank">https://scikit-learn.org/dev/modules/generated/sklearn.preprocessing.MultiLabelBinarizer.html</a><br>
and in particular the part that starts with "A common mistake is to pass<br>
in a list".<br>
<br>
Cheers,<br>
Lo?c<br>
<br>
> Hi.<br>
><br>
> I am working on a Multi-label text classification problem. In order to encode the labels, I am using MultiLabelBinarizer. The labels of the dataset look like -<br>
><br>
> image<br>
><br>
> When I am using<br>
><br>
> mlb = MultiLabelBinarizer()<br>
> mlb.fit(labels)<br>
> print(mlb.classes_)<br>
><br>
> I am getting -<br>
><br>
> image<br>
><br>
> Whereas, the output (sample output) I want is -<br>
><br>
> image<br>
><br>
> I got the above output by -<br>
><br>
> mlb = MultiLabelBinarizer()<br>
> sample_labels = [<br>
> ['stat.ML', 'cs.LG'],<br>
> ['cs.CV', 'cs.RO']<br>
> ]<br>
> mlb.fit(sample_labels)<br>
> print(mlb.classes_)<br>
><br>
> Help would be very much appreciated here.<br>
><br>
> Here's the dataset I had prepared:<br>
> arXivdata.csv.zip<br>
><br>
> I stripped away the double quotes in the labels after loading it in a pandas DataFrame by -<br>
><br>
> import re <br>
><br>
> arxiv_data['labels'] = arxiv_data['labels'].str.replace(r"[\"]", '')<br>
><br>
> scikit-learn version: '0.21.3'<br>
><br>
> Sayak Paul | <a href="http://sayak.dev" rel="noreferrer" target="_blank">sayak.dev</a><br>
<br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Thu, 12 Sep 2019 10:06:30 +0200<br>
From: Guillaume Lema?tre <<a href="mailto:g.lemaitre58@gmail.com" target="_blank">g.lemaitre58@gmail.com</a>><br>
To: Scikit-learn mailing list <<a href="mailto:scikit-learn@python.org" target="_blank">scikit-learn@python.org</a>><br>
Subject: Re: [scikit-learn] Vote on SLEP009: keyword only arguments<br>
Message-ID:<br>
<<a href="mailto:CACDxx9jCkE5GAjRNj3TKinbuyWZQvXMrrcHBBqn6q_FXYdPrbQ@mail.gmail.com" target="_blank">CACDxx9jCkE5GAjRNj3TKinbuyWZQvXMrrcHBBqn6q_FXYdPrbQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
To the question: do we want to utilise Python 3's force-keyword-argument<br>
syntax<br>
and to change existing APIs which support arguments positionally to use this<br>
syntax, via a deprecation period?<br>
<br>
I am +1.<br>
<br>
IMO, even if the syntax might be unknown, it will remain unknown until<br>
projects<br>
from the ecosystem are not using it.<br>
<br>
To the question: which methods should be impacted?<br>
<br>
I think we should be as gentle as possible at first. I am a little<br>
concerned about<br>
breaking some codes which were working fine before.<br>
<br>
On Thu, 12 Sep 2019 at 04:43, Joel Nothman <<a href="mailto:joel.nothman@gmail.com" target="_blank">joel.nothman@gmail.com</a>> wrote:<br>
<br>
> These there details of specific API changes to be decided:<br>
><br>
> The question being put, as per the SLEP, is:<br>
> do we want to utilise Python 3's force-keyword-argument syntax<br>
> and to change existing APIs which support arguments positionally to use<br>
> this syntax, via a deprecation period?<br>
> _______________________________________________<br>
> scikit-learn mailing list<br>
> <a href="mailto:scikit-learn@python.org" target="_blank">scikit-learn@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/scikit-learn</a><br>
><br>
<br>
<br>
-- <br>
Guillaume Lemaitre<br>
INRIA Saclay - Parietal team<br>
Center for Data Science Paris-Saclay<br>
<a href="https://glemaitre.github.io/" rel="noreferrer" target="_blank">https://glemaitre.github.io/</a><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mail.python.org/pipermail/scikit-learn/attachments/20190912/047eb83c/attachment-0001.html" rel="noreferrer" target="_blank">http://mail.python.org/pipermail/scikit-learn/attachments/20190912/047eb83c/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Thu, 12 Sep 2019 09:23:03 -0300<br>
From: Alejandro Javier Peralta Frias<br>
<<a href="mailto:alejandro.peralta@mercadolibre.com" target="_blank">alejandro.peralta@mercadolibre.com</a>><br>
To: <a href="mailto:scikit-learn@python.org" target="_blank">scikit-learn@python.org</a><br>
Subject: [scikit-learn] How can I enable line tracing for cython<br>
modules.<br>
Message-ID:<br>
<CAL+ZpG6ccwnnJm1Q2CQM4qt+sfiMtHV5Tr=<a href="mailto:mgsgFpcmASzUhZA@mail.gmail.com" target="_blank">mgsgFpcmASzUhZA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hello all,<br>
<br>
To enable cython tracing (in particular I want to line trace neighbors<br>
module) I understand that I have to recompile the cython modules with<br>
CYTHON_TRACE=1 but I'm not sure where should I set this.<br>
<br>
Should I use:<br>
<br>
# distutils: define_macros=CYTHON_TRACE_NOGIL=1<br>
<br>
<br>
In the files I want to trace?<br>
<br>
Regards,<br>
-- <br>
Ale<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mail.python.org/pipermail/scikit-learn/attachments/20190912/0377329b/attachment-0001.html" rel="noreferrer" target="_blank">http://mail.python.org/pipermail/scikit-learn/attachments/20190912/0377329b/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
scikit-learn mailing list<br>
<a href="mailto:scikit-learn@python.org" target="_blank">scikit-learn@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/scikit-learn</a><br>
<br>
<br>
------------------------------<br>
<br>
End of scikit-learn Digest, Vol 42, Issue 14<br>
********************************************<br>
</blockquote></div>