@@ -183,8 +183,7 @@ def __init__(
183
183
The number of initial samples that are just discarded and not used to estimate
184
184
the mass matrix.
185
185
early_update : bool
186
- Whether to update the mass matrix live during the first half of the first
187
- adaptation window.
186
+ Whether to update the mass matrix live during the first adaptation window.
188
187
store_mass_matrix_trace : bool
189
188
If true, store the mass matrix at each step of the adaptation. Only for debugging
190
189
purposes.
@@ -268,8 +267,8 @@ def update(self, sample, grad, tune):
268
267
return
269
268
270
269
if self ._n_samples > self ._discard_window :
271
- self ._foreground_var .add_sample (sample , weight = 1 )
272
- self ._background_var .add_sample (sample , weight = 1 )
270
+ self ._foreground_var .add_sample (sample )
271
+ self ._background_var .add_sample (sample )
273
272
274
273
if self ._early_update or self ._n_samples > self .adaptation_window :
275
274
self ._update_from_weightvar (self ._foreground_var )
@@ -344,15 +343,13 @@ def __init__(
344
343
if self .mean .shape != (nelem ,):
345
344
raise ValueError ("Invalid shape for initial mean." )
346
345
347
- def add_sample (self , x , weight ):
346
+ def add_sample (self , x ):
348
347
x = np .asarray (x )
349
- if weight != 1 :
350
- raise ValueError ("Setting weight != 1 is not supported." )
351
348
self .n_samples += 1
352
349
old_diff = x - self .mean
353
350
self .mean [:] += old_diff / self .n_samples
354
351
new_diff = x - self .mean
355
- self .raw_var [:] += weight * old_diff * new_diff
352
+ self .raw_var [:] += old_diff * new_diff
356
353
357
354
def current_variance (self , out = None ):
358
355
if self .n_samples == 0 :
@@ -666,8 +663,8 @@ def update(self, sample, grad, tune):
666
663
# Steps since previous update
667
664
delta = self ._n_samples - self ._previous_update
668
665
669
- self ._foreground_cov .add_sample (sample , weight = 1 )
670
- self ._background_cov .add_sample (sample , weight = 1 )
666
+ self ._foreground_cov .add_sample (sample )
667
+ self ._background_cov .add_sample (sample )
671
668
672
669
# Update the covariance matrix and recompute the Cholesky factorization
673
670
# every "update_window" steps
@@ -726,13 +723,13 @@ def __init__(
726
723
if self .mean .shape != (nelem ,):
727
724
raise ValueError ("Invalid shape for initial mean." )
728
725
729
- def add_sample (self , x , weight ):
726
+ def add_sample (self , x ):
730
727
x = np .asarray (x )
731
728
self .n_samples += 1
732
729
old_diff = x - self .mean
733
730
self .mean [:] += old_diff / self .n_samples
734
731
new_diff = x - self .mean
735
- self .raw_cov [:] += weight * new_diff [:, None ] * old_diff [None , :]
732
+ self .raw_cov [:] += new_diff [:, None ] * old_diff [None , :]
736
733
737
734
def current_covariance (self , out = None ):
738
735
if self .n_samples == 0 :
0 commit comments