Skip to content

Commit

Permalink
Pure foreward stagewise regression
Browse files Browse the repository at this point in the history
  • Loading branch information
Blunde1 committed May 21, 2024
1 parent c11512e commit 6b4ada5
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions src/ert/analysis/_es_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,27 @@ def adaptive_localization_progress_callback(
else:
### EnIF ###
start_enif = time.time()

# Load all parameters at once
X_full = _all_parameters(
ensemble=source_ensemble,
iens_active_index=iens_active_index,
)
print(f"full parameter matrix shape: {X_full.shape}")

X_full_scaler = StandardScaler()
X_full_scaled = X_full_scaler.fit_transform(X_full.T)
print(f"Scaled X_full has shape: {X_full_scaled.shape}")

# Call fit: Learn sparse linear map only
H = linear_boost_ic_regression(
U=X_full_scaled,
Y=S.T,
learning_rate=1.0,
effective_dimension=0,
verbose_level=5,
)

Prec_u = sp.sparse.csc_matrix((0, 0), dtype=float)
for param_group in parameters:
print(f"loading parameter group {param_group}")
Expand Down Expand Up @@ -561,28 +582,8 @@ def adaptive_localization_progress_callback(
format="csc",
)

# Load all parameters at once
X_full = _all_parameters(
ensemble=source_ensemble,
iens_active_index=iens_active_index,
)
print(f"full parameter matrix shape: {X_full.shape}")

X_full_scaler = StandardScaler()
X_full_scaled = X_full_scaler.fit_transform(X_full.T)
print(f"Scaled X_full has shape: {X_full_scaled.shape}")

# Call fit: Learn sparse linear map only
H = linear_boost_ic_regression(
U=X_full_scaled,
Y=S.T,
learning_rate=0.95,
effective_dimension=0,
verbose_level=5,
)

# Initialize EnIF object with full precision matrices
eps = 1e-2 # for better condition number
eps = 1e-3 # for better condition number
gtmap = EnIF(
Prec_u=(1 - eps) * Prec_u + eps * sp.sparse.eye(Prec_u.shape[0]),
Prec_eps=Prec_eps,
Expand Down

0 comments on commit 6b4ada5

Please sign in to comment.