|
4 | 4 |
|
5 | 5 |
|
6 | 6 | class SNMFOptimizer:
|
7 |
| - """A self-contained implementation of the stretched NMF algorithm (sNMF), |
8 |
| - including sparse stretched NMF. |
| 7 | + """A implementation of stretched NMF (sNMF), including sparse stretched NMF. |
9 | 8 |
|
10 | 9 | Instantiating the SNMFOptimizer class runs all the analysis immediately.
|
11 | 10 | The results matrices can then be accessed as instance attributes
|
@@ -33,44 +32,39 @@ def __init__(
|
33 | 32 |
|
34 | 33 | Parameters
|
35 | 34 | ----------
|
36 |
| - MM: ndarray |
37 |
| - The array containing the data to be decomposed. Shape is (length_of_signal, |
38 |
| - number_of_conditions). |
39 |
| - Y0: ndarray |
40 |
| - The array containing initial guesses for the component weights |
41 |
| - at each stretching condition. Shape is (number of components, number of |
42 |
| - conditions) Must be provided if n_components is not provided. Will override |
43 |
| - n_components if both are provided. |
44 |
| - X0: ndarray |
45 |
| - The array containing initial guesses for the intensities of each component per |
| 35 | + MM : ndarray |
| 36 | + The data to be decomposed. Shape is (length_of_signal, number_of_conditions). |
| 37 | + Y0 : ndarray |
| 38 | + The initial guesses for the component weights at each stretching condition. |
| 39 | + Shape is (number of components, number ofconditions) Must be provided if |
| 40 | + n_components is not provided. Will override n_components if both are provided. |
| 41 | + X0 : ndarray |
| 42 | + The initial guesses for the intensities of each component per |
46 | 43 | row/sample/angle. Shape is (length_of_signal, number_of_components).
|
47 |
| - A: ndarray |
48 |
| - The array containing initial guesses for the stretching factor for each component, |
49 |
| - at each condition. Shape is (number_of_components, number_of_conditions). |
50 |
| - rho: float |
51 |
| - The float which sets a stretching factor that influences the decomposition. |
52 |
| - Zero corresponds to no stretching present. Relatively insensitive and typically |
53 |
| - adjusted in powers of 10. |
54 |
| - eta: float |
55 |
| - The integer which sets a sparsity factor than influences the decomposition. |
56 |
| - Should be set to zero for non sparse data such as PDF. Can be used to improve |
57 |
| - results for sparse data such as XRD, but due to instability, should be used |
58 |
| - only after first selecting the best value for rho. |
59 |
| - max_iter: int |
| 44 | + A : ndarray |
| 45 | + The initial guesses for the stretching factor for each component, at each |
| 46 | + condition. Shape is (number_of_components, number_of_conditions). |
| 47 | + rho : float |
| 48 | + The stretching factor that influences the decomposition. Zero corresponds to no |
| 49 | + stretching present. Relatively insensitive and typically adjusted in powers of 10. |
| 50 | + eta : float |
| 51 | + The sparsity factor than influences the decomposition. Should be set to zero for |
| 52 | + non-sparse data such as PDF. Can be used to improve results for sparse data such |
| 53 | + as XRD, but due to instability, should be used only after first selecting the |
| 54 | + best value for rho. |
| 55 | + max_iter : int |
60 | 56 | The maximum number of times to update each of A, X, and Y before stopping
|
61 | 57 | the optimization.
|
62 |
| - tol: float |
63 |
| - The minimum fractional improvement in the objective function to allow |
64 |
| - without terminating the optimization. Note that a minimum of 20 updates |
65 |
| - are run before this parameter is checked. |
66 |
| - n_components: int |
| 58 | + tol : float |
| 59 | + The convergence threshold. This is the minimum fractional improvement in the |
| 60 | + objective function to allow without terminating the optimization. Note that |
| 61 | + a minimum of 20 updates are run before this parameter is checked. |
| 62 | + n_components : int |
67 | 63 | The number of components to attempt to extract from MM. Note that this will
|
68 | 64 | be overridden by Y0 if that is provided, but must be provided if no Y0 is
|
69 | 65 | provided.
|
70 |
| - random_state: int |
71 |
| - The integer which acts as a reproducible seed for the initial matrices used in |
72 |
| - the optimization. Due to the non-convex nature of the problem, results may vary |
73 |
| - even with the same initial guesses, so this does not make the program deterministic. |
| 66 | + random_state : int |
| 67 | + The seed for the initial matrices used in the optimization. |
74 | 68 | """
|
75 | 69 |
|
76 | 70 | self.MM = MM
|
|
0 commit comments