@@ -60,11 +60,12 @@ def __init__(
60
60
objective function to allow without terminating the optimization. Note that
61
61
a minimum of 20 updates are run before this parameter is checked.
62
62
n_components : int
63
- The number of components to attempt to extract from MM. Note that this will
63
+ The number of components to extract from MM. Note that this will
64
64
be overridden by Y0 if that is provided, but must be provided if no Y0 is
65
65
provided.
66
66
random_state : int
67
- The seed for the initial matrices used in the optimization.
67
+ The seed for the initial guesses at the matrices (A, X, and Y) created by
68
+ the decomposition.
68
69
"""
69
70
70
71
self .MM = MM
@@ -76,21 +77,21 @@ def __init__(
76
77
# Capture matrix dimensions
77
78
self .N , self .M = MM .shape
78
79
self .num_updates = 0
79
- self .rng = np .random .default_rng (random_state )
80
+ self ._rng = np .random .default_rng (random_state )
80
81
81
82
if Y0 is None :
82
83
if n_components is None :
83
84
raise ValueError ("Must provide either Y0 or n_components." )
84
85
else :
85
86
self .K = n_components
86
- self .Y0 = self .rng .beta (a = 2.5 , b = 1.5 , size = (self .K , self .M ))
87
+ self .Y0 = self ._rng .beta (a = 2.5 , b = 1.5 , size = (self .K , self .M ))
87
88
else :
88
89
self .K = Y0 .shape [0 ]
89
90
90
91
if self .A is None :
91
- self .A = np .ones ((self .K , self .M )) + self .rng .normal (0 , 1e-3 , size = (self .K , self .M ))
92
+ self .A = np .ones ((self .K , self .M )) + self ._rng .normal (0 , 1e-3 , size = (self .K , self .M ))
92
93
if self .X0 is None :
93
- self .X0 = self .rng .random ((self .N , self .K ))
94
+ self .X0 = self ._rng .random ((self .N , self .K ))
94
95
95
96
self .X = np .maximum (0 , self .X0 )
96
97
self .Y = np .maximum (0 , self .Y0 )
0 commit comments