Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return variance explained for all components #50

Merged
merged 1 commit into from
Mar 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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