Skip to content

Commit

Permalink
Adjust threshold logic for nr pca components
Browse files Browse the repository at this point in the history
  • Loading branch information
larsevj committed Feb 4, 2025
1 parent 6ba3112 commit 4a0ea64
Show file tree
Hide file tree
Showing 5 changed files with 650 additions and 642 deletions.
8 changes: 7 additions & 1 deletion src/ert/analysis/misfit_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ def get_nr_primary_components(
# We compute the cumulative sum of these, then divide by their total sum to get the
# cumulative proportion of variance explained by each successive component.
variance_ratio = np.cumsum(singulars**2) / np.sum(singulars**2)
return len([1 for i in variance_ratio[:-1] if i < threshold])
rate_of_variance = np.diff(variance_ratio, append=1)
return int(
min(
np.argmax(rate_of_variance < 0.05) + 1,
np.argmax(variance_ratio >= threshold) + 1,
)
)


def cluster_responses(
Expand Down
Loading

0 comments on commit 4a0ea64

Please sign in to comment.