Skip to content

Commit

Permalink
MAINT: minor fixes to GaussianNB epsilon
Browse files Browse the repository at this point in the history
  • Loading branch information
jakevdp committed Oct 7, 2015
1 parent e2e33aa commit eac920d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sklearn/naive_bayes.py
Expand Up @@ -324,7 +324,7 @@ def _partial_fit(self, X, y, classes=None, _refit=False,
# will cause numerical errors. To address this, we artificially
# boost the variance by epsilon, a small fraction of the standard
# deviation of the largest dimension.
epsilon = 1e-9 * np.var(X, 0).max()
epsilon = 1e-9 * np.var(X, axis=0).max()

if _refit:
self.classes_ = None
Expand Down
4 changes: 2 additions & 2 deletions sklearn/tests/test_naive_bayes.py
Expand Up @@ -473,6 +473,6 @@ def test_naive_bayes_scale_invariance():
iris = load_iris()
X, y = iris.data, iris.target
labels = [GaussianNB().fit(f * X, y).predict(f * X)
for f in [1E-5, 1, 1E5]]
for f in [1E-10, 1, 1E10]]
assert_array_equal(labels[0], labels[1])
assert_array_equal(labels[0], labels[2])
assert_array_equal(labels[1], labels[2])

0 comments on commit eac920d

Please sign in to comment.