[scikit-learn] Generate data from trained naive bayes

klo uo klonuo at gmail.com
Mon Oct 3 13:45:29 EDT 2016


Hi Manoj,

thanks for your reply.

Sorry to say, but I don't understand how to generate new feature.
In this example I have `X` with shape (1000, 64) with 5 unique classes.
`feature_log_prob_` has shape (5, 64)

I can generate for example uniform data with `r = np.random.rand(64)`
Now how can I generate new features, having trained classifier?



On Mon, Oct 3, 2016 at 5:23 PM, Manoj Kumar <manojkumarsivaraj334 at gmail.com>
wrote:

> Hi,
>
> feature_log_prob_ is an array of size (n_classes, n_features).
>
> exp(feature_log_prob_[class_ind, feature_ind]) gives P(X_{feature_ind} =
> 1 | class_ind)"
>
> Using the conditional independence assumptions of NaiveBayes, you can use
> this to sample each feature independently given the class.
>
> Hope that helps.
>
>
>
>
> On Mon, Oct 3, 2016 at 11:09 AM, klo uo <klonuo at gmail.com> wrote:
>
>> On Mon, Oct 3, 2016 at 5:08 PM, klo uo <klonuo at gmail.com> wrote:
>>
>>> I can see how can I sample from `feature_log_prob_`...
>>>
>>
>> I meant I cannot see
>>
>>
>> _______________________________________________
>> scikit-learn mailing list
>> scikit-learn at python.org
>> https://mail.python.org/mailman/listinfo/scikit-learn
>>
>>
>
>
> --
> Manoj,
> http://github.com/MechCoder
>
> _______________________________________________
> 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/20161003/aa699321/attachment-0001.html>


More information about the scikit-learn mailing list