Skip to content

Commit

Permalink
Return variance explained for all components (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
eurunuela authored Mar 16, 2022
1 parent cf42a93 commit 90ca567
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions mapca/mapca.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,20 @@ class MovingAveragePCA:
- 'n_components': The number of components chosen by the MDL criterion.
- 'value': The MDL curve values.
- 'explained_variance_total': The total explained variance of the components.
varexp_90 : dict
varexp_90_ : dict
Dictionary containing the 90% variance explained results:
- 'n_components': The number of components chosen by the 90% variance explained
criterion.
- 'explained_variance_total': The total explained variance of the components.
varexp_95 : dict
varexp_95_ : dict
Dictionary containing the 95% variance explained results:
- 'n_components': The number of components chosen by the 95% variance explained
criterion.
- 'explained_variance_total': The total explained variance of the components.
all_ : dict
Dictionary containing the results for all possible components:
- 'n_components': Total number of possible components.
- 'explained_variance_total': The total explained variance of the components.
References
----------
Expand Down Expand Up @@ -336,6 +340,10 @@ def _fit(self, img, mask):
"n_components": n_comp_varexp_95,
"explained_variance_total": cumsum_varexp[n_comp_varexp_95 - 1],
}
self.all_ = {
"n_components": ppca.n_components_,
"explained_variance_total": cumsum_varexp,
}

# Assign attributes from model
self.components_ = ppca.components_[:n_components, :]
Expand Down

0 comments on commit 90ca567

Please sign in to comment.