[scikit-learn] Along with Predictive probability and class name how to get the multi-text(text) belonging to that class

Gunasekar K imguna2003 at gmail.com
Tue Aug 13 05:01:15 EDT 2019


Thank you for your e-mail.

I am not looking for class prediction, as I am using similar concept to
recognize them.
Exactly I am looking for the text which points to the class as identified
by the model.


"Humpty Dumpty sat on the wall"

when above statement fed to the pre-trained/saved model it returns the
class output as "Character".

Also I want the text part which trained for that respective class. Assuming
"Humpty Dumpty" is trained under "Character" class.

Thank you,

Best regards




On Tue, 13 Aug 2019 at 13:21, Guillaume Lemaître <g.lemaitre58 at gmail.com>
wrote:

> I am unsure if it what you need but you can take the argmax (or call
> predict) and get the value of model.classes_.
> In short, model.classes_[model.predict([invoice_parameter])].
>
> On Tue, 13 Aug 2019 at 09:01, Gunasekar K <imguna2003 at gmail.com> wrote:
>
>> Hi Team,
>>
>> Greetings!!!
>>
>> Assuming ''Humpty Dumpty" is text trained under given specific model
>> belonging to class called "cartoon character" in multi-text classification
>> model.
>>
>> *model.predict_proba([Invoice_parameter])*100* gives the probability of
>> belongings to specific class.
>>
>> But how come I can retrieve the *text* for that probability hit for that
>> class.
>>
>> for example,
>>
>> Invoice_parameter= input() ---- on the fly input
>>
>> "Humpty Dumpty sat on the wall"
>>
>> *model.predict_proba([Invoice_parameter])*100*
>>
>> I get probability of 99.09 (rounded to two decimal places) to character
>> class but i also need to retrieve the text  Humpty Dumpty.
>>
>> Any help or suggestions are appreciated.
>>
>> Thanks in advance.
>>
>> Kind regards,
>> GK
>>
>>
>>
>>
>> _______________________________________________
>> 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/20190813/f1688565/attachment.html>


More information about the scikit-learn mailing list