Skip to content

Commit e05225f

Browse files
wielandbrendelWieland Brendel
andauthored
Fixmean (#29)
* fixed bug in compute_mean_score function * updated version number Co-authored-by: Wieland Brendel <[email protected]>
1 parent 918b822 commit e05225f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

python/dPCA/dPCA.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -803,9 +803,9 @@ def compute_mean_score(X,trialX,n_splits):
803803
K = 1 if axis is None else X.shape[-1]
804804

805805
if type(self.n_components) == int:
806-
scores = {key : np.empty((self.n_components,K)) for key in keys}
806+
scores = {key : np.empty((self.n_components, n_splits, K)) for key in keys}
807807
else:
808-
scores = {key : np.empty((self.n_components[key],K)) for key in keys}
808+
scores = {key : np.empty((self.n_components[key], n_splits, K)) for key in keys}
809809

810810
for shuffle in range(n_splits):
811811
print('.', end=' ')
@@ -841,8 +841,11 @@ def compute_mean_score(X,trialX,n_splits):
841841
for key in keys:
842842
ncomps = self.n_components if type(self.n_components) == int else self.n_components[key]
843843
for comp in range(ncomps):
844-
scores[key][comp] = classification(trainZ[key][comp],validZ[key][comp])
844+
scores[key][comp, shuffle] = classification(trainZ[key][comp],validZ[key][comp])
845845

846+
for key in keys:
847+
scores[key] = np.nanmean(scores[key], axis=1)
848+
846849
return scores
847850

848851
if self.opt_regularizer_flag:

python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
MAINTAINER_EMAIL = "[email protected]"
2020
DOWNLOAD_URL = 'https://github.com/machenslab/dPCA/'
2121
LICENSE = 'MIT'
22-
VERSION = '1.0'
22+
VERSION = '1.0.5'
2323

2424
setup(name=NAME,
2525
version=VERSION,

0 commit comments

Comments
 (0)