@@ -69,16 +69,14 @@ def __init__(
6969 init_weights = None ,
7070 init_components = None ,
7171 init_stretch = None ,
72- rho = 0 ,
73- eta = 0 ,
7472 max_iter = 500 ,
7573 min_iter = 20 ,
7674 tol = 5e-7 ,
7775 n_components = None ,
7876 random_state = None ,
7977 show_plots = False ,
8078 ):
81- """Initialize an instance of SNMF and run the optimization .
79+ """Initialize an instance of sNMF .
8280
8381 Parameters
8482 ----------
@@ -95,14 +93,6 @@ def __init__(
9593 0, 1e-3, size=(self.n_components, self.n_signals)
9694 The initial guesses for the stretching factor for each component, at each
9795 condition (for each signal). Shape is (number_of_components, number_of_signals).
98- rho : float Optional Default = 0
99- The stretching factor that influences the decomposition. Zero corresponds to no
100- stretching present. Relatively insensitive and typically adjusted in powers of 10.
101- eta : int Optional Default = 0
102- The sparsity factor that influences the decomposition. Should be set to zero for
103- non-sparse data such as PDF. Can be used to improve results for sparse data such
104- as XRD, but due to instability, should be used only after first selecting the
105- best value for rho. Suggested adjustment is by powers of 2.
10696 max_iter : int Optional Default = 500
10797 The maximum number of times to update each of A, X, and Y before stopping
10898 the optimization.
@@ -121,8 +111,6 @@ def __init__(
121111 """
122112
123113 self .source_matrix = source_matrix
124- self .rho = rho
125- self .eta = eta
126114 self .tol = tol
127115 self .max_iter = max_iter
128116 self .min_iter = min_iter
@@ -172,7 +160,23 @@ def __init__(
172160 [1 , - 2 , 1 ], offsets = [0 , 1 , 2 ], shape = (self .n_signals - 2 , self .n_signals )
173161 )
174162
175- def fit (self ):
163+ def fit (self , rho = 0 , eta = 0 ):
164+ """Run the sNMF optimization with the given parameters, using the setup from __init__.
165+
166+ Parameters
167+ ----------
168+ rho : float Optional Default = 0
169+ The stretching factor that influences the decomposition. Zero corresponds to no
170+ stretching present. Relatively insensitive and typically adjusted in powers of 10.
171+ eta : int Optional Default = 0
172+ The sparsity factor that influences the decomposition. Should be set to zero for
173+ non-sparse data such as PDF. Can be used to improve results for sparse data such
174+ as XRD, but due to instability, should be used only after first selecting the
175+ best value for rho. Suggested adjustment is by powers of 2.
176+ """
177+
178+ self .rho = rho
179+ self .eta = eta
176180
177181 # Set up residual matrix, objective function, and history
178182 self .residuals = self .get_residual_matrix ()
0 commit comments