[scikit-learn] Generate data from trained naive bayes
klo uo
klonuo at gmail.com
Mon Oct 3 15:18:30 EDT 2016
Great.
Thanks for your time Manoj
Cheers,
Klo
On Mon, Oct 3, 2016 at 8:20 PM, Manoj Kumar <manojkumarsivaraj334 at gmail.com>
wrote:
> Let's say you would like to generate just the first feature of 1000
> samples with label 0.
>
> The distribution of the first feature conditioned on label 1 follows a
> Bernoulli distribution (as suggested by the name) with parameter
> "exp(feature_log_prob_[0, 0])". You could then generate the first feature
> of these 1000 samples by just doing
>
> first_feature = bernoulli.rvs(exp(feature_log_prob_[0, 0]), size=1000)
>
> And follow the same approach for all the other features with the
> corresponding parameters. (They are conditionally independent)
>
>
> _______________________________________________
> 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/f065d8c9/attachment-0001.html>
More information about the scikit-learn
mailing list