Skip to content

Commit 37a6491

Browse files
committed
safe_min instead of min
1 parent dcd0b97 commit 37a6491

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sklearn/decomposition/nmf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from ..base import BaseEstimator, TransformerMixin
2121
from ..utils import check_random_state, check_array
2222
from ..utils.extmath import randomized_svd, safe_sparse_dot, squared_norm
23-
from ..utils.extmath import fast_dot
23+
from ..utils.extmath import fast_dot, safe_min
2424
from ..utils.validation import check_is_fitted, check_non_negative
2525
from ..exceptions import ConvergenceWarning
2626
from .cdnmf_fast import _update_cdnmf_fast
@@ -954,7 +954,7 @@ def non_negative_factorization(X, W=None, H=None, n_components=None,
954954
check_non_negative(X, "NMF (input X)")
955955
beta_loss = _check_string_param(solver, regularization, beta_loss, init)
956956

957-
if X.min() == 0 and beta_loss <= 0:
957+
if safe_min(X) == 0 and beta_loss <= 0:
958958
raise ValueError("When beta_loss <= 0 and X contains zeros, "
959959
"the solver may diverge. Please add small values to "
960960
"X, or use a positive beta_loss.")

0 commit comments

Comments
 (0)