question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

In `sklearn.naive_bayes`, `GaussianNB` model return an attribute called `sigma_`.

See original GitHub issue

In the document, sigma_ is the variance of each feature per class, but in general, it means standard variation. So we either change its name to variance_ or call sigma_ the std of each feature per class.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
thomasjpfancommented, Apr 5, 2020

For example, Sigma can be used to represent the covariance matrix in multivariate normal distributions:

Screen Shot 2020-04-05 at 11 28 35 AM

While for the single variable case:

Screen Shot 2020-04-05 at 11 29 07 AM

Anyways for this case, I am okay with this being var_.

On a side note, it is a little strange how the attribute names do not match the variables in the user guide: https://scikit-learn.org/stable/modules/naive_bayes.html#gaussian-naive-bayes

Currently, theta_ is used for the mean and sigma_ is used for the variance.

0reactions
hongshaoyangcommented, Nov 14, 2020

take

Read more comments on GitHub >

github_iconTop Results From Across the Web

sklearn.naive_bayes.GaussianNB
Returns the log-probability of the samples for each class in the model. The columns correspond to the classes in sorted order, as they...
Read more >
Source code for sklearn.naive_bayes - Diffprivlib
return np.exp(self.predict_log_proba(X)) class GaussianNB(_BaseNB): """ Gaussian Naive Bayes (GaussianNB). Can perform online updates to model parameters ...
Read more >
AttributeError: 'GaussianNB' object has no attribute 'var_'
The model is being generated with sckikit-learn version 0.24.2 or less and it's being read by a scikit-learn version 1.0.0 or higher.
Read more >
8.20.1. sklearn.naive_bayes.GaussianNB - GitHub Pages
class sklearn.naive_bayes.GaussianNB¶. Gaussian Naive Bayes (GaussianNB) ... Returns the log-probability of the sample for each class in the model, ...
Read more >
mdp.nodes.GaussianNBScikitsLearnNode
Class GaussianNBScikitsLearnNode. Gaussian Naive Bayes (GaussianNB) This node has been automatically generated by wrapping the ``sklearn.naive_bayes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found