Skip to content

Commit fdbacb3

Browse files
author
John Halloran
committed
docs: update docstring and imports
1 parent d194af5 commit fdbacb3

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/diffpy/snmf/snmf_class.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# import cvxpy as cp
12
import numpy as np
23
from scipy.optimize import minimize
34
from scipy.sparse import coo_matrix, csc_matrix, diags
@@ -39,13 +40,16 @@ class SNMFOptimizer:
3940
max_iter : int
4041
The maximum number of times to update each of stretch, components, and weights before stopping
4142
the optimization.
43+
min_iter : int
44+
The minimum number of times to update each of stretch, components, and weights before terminating
45+
the optimization due to low/no improvement.
4246
tol : float
4347
The convergence threshold. This is the minimum fractional improvement in the
4448
objective function to allow without terminating the optimization. Note that
45-
a minimum of 20 updates are run before this parameter is checked.
49+
a minimum of min_iter updates are run before this parameter is checked.
4650
n_components : int
4751
The number of components to extract from source_matrix. Must be provided when and only when
48-
Y0 is not provided.
52+
init_weights is not provided.
4953
random_state : int
5054
The seed for the initial guesses at the matrices (stretch, components, and weights) created by
5155
the decomposition.
@@ -98,13 +102,16 @@ def __init__(
98102
max_iter : int Optional Default = 500
99103
The maximum number of times to update each of A, X, and Y before stopping
100104
the optimization.
105+
min_iter: int Optional Default = 20
106+
The minimum number of times to update each of stretch, components, and weights before terminating
107+
the optimization due to low/no improvement.
101108
tol : float Optional Default = 5e-7
102109
The convergence threshold. This is the minimum fractional improvement in the
103110
objective function to allow without terminating the optimization. Note that
104111
a minimum of 20 updates are run before this parameter is checked.
105112
n_components : int Optional Default = None
106113
The number of components to extract from source_matrix. Must be provided when and only when
107-
Y0 is not provided.
114+
init_weights is not provided.
108115
random_state : int Optional Default = None
109116
The seed for the initial guesses at the matrices (A, X, and Y) created by
110117
the decomposition.
@@ -118,7 +125,7 @@ def __init__(
118125
self.num_updates = 0
119126
self._rng = np.random.default_rng(random_state)
120127

121-
# Enforce exclusive specification of n_components or Y0
128+
# Enforce exclusive specification of n_components or init_weights
122129
if (n_components is None and init_weights is None) or (
123130
n_components is not None and init_weights is not None
124131
):

0 commit comments

Comments
 (0)