Skip to content

Commit

Permalink
Merge pull request #274 from scottclowe/mnt_alpha-deprecation
Browse files Browse the repository at this point in the history
MNT: Prevent deprecation warning about alpha removal in sklearn v1.2
  • Loading branch information
scottclowe committed Mar 24, 2022
2 parents 6a1149a + 8ad5762 commit 3126789
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions fissa/neuropil.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,16 @@ def separate(

# Make an instance of the sklearn NMF class
with warnings.catch_warnings():
warnings.simplefilter("ignore", DeprecationWarning)
warnings.filterwarnings(
"ignore",
message=".*`alpha` was deprecated in.*",
category=DeprecationWarning,
)
warnings.filterwarnings(
"ignore",
message=".*`alpha` was deprecated in.*",
category=FutureWarning,
)
estimator = sklearn.decomposition.NMF(
init="nndsvdar" if W0 is None and H0 is None else "custom",
n_components=n,
Expand All @@ -193,9 +202,8 @@ def separate(
max_iter=max_iter,
random_state=random_state,
)

# Perform NMF and find separated signals
S_sep = estimator.fit_transform(S.T, W=W0, H=H0)
# Perform NMF and find separated signals
S_sep = estimator.fit_transform(S.T, W=W0, H=H0)

elif hasattr(sklearn.decomposition, sep_method):
if verbosity >= 1:
Expand Down

0 comments on commit 3126789

Please sign in to comment.