Skip to content

Commit 690d248

Browse files
author
Alexey Stukalov
committed
replace_observed(SemWLS, ...; update_internal_state)
the kwarg specifies whether to recalculate weights
1 parent bfd32b4 commit 690d248

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/loss/WLS/WLS.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,17 @@ function evaluate!(objective, gradient, hessian, loss::SemWLS, par)
181181

182182
return objective
183183
end
184+
185+
function replace_observed(
186+
loss::SemWLS,
187+
new_observed::SemObserved;
188+
update_internal_state::Bool = true,
189+
)
190+
# recompute weight matrices only if update_internal_state=true
191+
return SemWLS(
192+
new_observed,
193+
SEM.implied(loss);
194+
wls_weight_matrix = update_internal_state ? nothing : loss.V,
195+
wls_weight_matrix_mean = update_internal_state ? nothing : loss.V_μ,
196+
)
197+
end

0 commit comments

Comments
 (0)