<div dir="ltr">Dear all,<div><br></div><div>Suppose I have two conditions, n runs with m trial and each trial is composed by t volumes (frames). I would like to do a time-wise (time-resolved) decoding to have the decoding accuracy curve for each time frame.</div><div>I saw several approaches to do this:</div><div>1) the first is to train the classifier using t datasets one for each time frame using volumes belonging to the same time frame thus I will have t accuracies </div><div>2) the second is to train the classifier using the within-trial averaged dataset (mean of t frames) and then test using each time-frame so having also t accuracies.</div><div><br></div><div>Q1: Which approach will you use? Are there other approaches?</div><div><br></div><div>I would like to implement the second one in PyMVPA, so that the classifier needs to average in the training step on the training chunk of the dataset. </div><div>I made a little test extending LinearCSVM class overriding the _train function:</div><div><div>    </div><div>def _train(self, ds):</div><div>        avg_mapper = mean_group_sample(['trial']) # I build my ds with this attr</div><div>        ds = ds.get_mapped(avg_mapper)</div><div>        return LinearCSVMC._train(self, ds)</div></div><div><br></div><div>Moreover I implemented an error class to compute time wise test error, to be passed to the CrossValidation:</div><div><br></div><div>class ErrorPerTrial(BinaryFxNode):<br></div><div>      def _call(self, ds):</div><div>           [...same code of the parent class...]</div><div>           err = [self.fx(values[ds.sa.frame == i], targets[ds.sa.frame == i]) </div><div>               for i in np.unique(ds.sa.frame)] # I compute a list of fx values</div><div><br></div><div>I think that maybe the ErrorPerTrial class is almost good (but if you have a more elegant solution is well-accepted :)), while extending every classifier is the worst solution, maybe a decorator or a wrapper is a possible solution.</div><div><br></div><div>Q2: How to implement this (if not yet implemented in pymvpa)? Could be a solution build an TrialAverager class that extends Learner with a classifier as input parameter and perform averaging?</div><div><br></div><div>Sorry for the tricky and long post.</div><div><br></div><div>Thank you,</div><div>Roberto</div></div>