Skip to content

Commit 90ca567

Browse files
authored
Return variance explained for all components (#50)
1 parent cf42a93 commit 90ca567

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

mapca/mapca.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,20 @@ class MovingAveragePCA:
100100
- 'n_components': The number of components chosen by the MDL criterion.
101101
- 'value': The MDL curve values.
102102
- 'explained_variance_total': The total explained variance of the components.
103-
varexp_90 : dict
103+
varexp_90_ : dict
104104
Dictionary containing the 90% variance explained results:
105105
- 'n_components': The number of components chosen by the 90% variance explained
106106
criterion.
107107
- 'explained_variance_total': The total explained variance of the components.
108-
varexp_95 : dict
108+
varexp_95_ : dict
109109
Dictionary containing the 95% variance explained results:
110110
- 'n_components': The number of components chosen by the 95% variance explained
111111
criterion.
112112
- 'explained_variance_total': The total explained variance of the components.
113+
all_ : dict
114+
Dictionary containing the results for all possible components:
115+
- 'n_components': Total number of possible components.
116+
- 'explained_variance_total': The total explained variance of the components.
113117
114118
References
115119
----------
@@ -336,6 +340,10 @@ def _fit(self, img, mask):
336340
"n_components": n_comp_varexp_95,
337341
"explained_variance_total": cumsum_varexp[n_comp_varexp_95 - 1],
338342
}
343+
self.all_ = {
344+
"n_components": ppca.n_components_,
345+
"explained_variance_total": cumsum_varexp,
346+
}
339347

340348
# Assign attributes from model
341349
self.components_ = ppca.components_[:n_components, :]

0 commit comments

Comments
 (0)