Skip to content

Commit

Permalink
standard scaling to data
Browse files Browse the repository at this point in the history
  • Loading branch information
Blunde1 committed Apr 11, 2024
1 parent ce7baff commit 36a310b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ert/analysis/_es_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from iterative_ensemble_smoother.experimental import (
AdaptiveESMDA,
)
from sklearn.preprocessing import StandardScaler
from typing_extensions import Self

from ..config.analysis_module import ESSettings, IESSettings
Expand Down Expand Up @@ -601,6 +602,7 @@ def adaptive_localization_progress_callback(
## EnIF
# Re-use cholesky ordering, etc. related to graph optimization
graph_cache = {}
scaler_cache = {}

# Iterate over parameters to fit sub-precision matrices
Prec_u = sp.sparse.csc_matrix((0, 0), dtype=float)
Expand All @@ -614,6 +616,10 @@ def adaptive_localization_progress_callback(
source, iens_active_index, param_group
)
X_local = temp_storage[param_group]
X_local_scaler = StandardScaler()
X_scaled = X_local_scaler.fit_transform(X_local.T)
scaler_cache[param_group] = X_local_scaler

graph_u_sub = config_node.load_parameter_graph(
source_ensemble, param_group, iens_active_index
)
Expand All @@ -636,7 +642,7 @@ def adaptive_localization_progress_callback(

Prec_u_sub, Graph_C_sub, perm_compose_sub, P_rev_sub, P_order_sub = (
fit_precision_cholesky(
X_local.T,
X_scaled,
graph_u_sub,
ordering_method="amd",
verbose_level=5,
Expand Down

0 comments on commit 36a310b

Please sign in to comment.