<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Thanks Yarik!</span></div><div><br><span></span></div><div><span>I don't pretend to understand the code (yet), but it runs without error, except for this warning:</span></div><div><br><span></span></div><div><span>WARNING: There were no samples for combination {'targets': 'HI', 'custom': 10}. It might be a sign of a disbalanced dataset <Dataset: 207x310@float64, <sa: blocks,censor,TR,custom,chunks,TR2,targets,partitions>, <a: mapper,lastpartitionset,partitions_set,lastsplit>>.</span></div><div><br><span></span></div>So I'll take your word for it that it is doing what I think it is supposed to do, for now? :)<br><br>-Edmund<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <div
 dir="ltr"> <font face="Arial" size="2"> <hr size="1"><b><span style="font-weight: bold;"></span></b></font>interesting question...<br></div><br>quick answer: we don't have 1 liner pre-crafted solution but I see few<br>possible resolutions for you ;-)  you are hitting a tiny problem though<br>(which was recently brought up by M.Casey email) that output number of<br>predictions from the classifier cannot be different from # of samples of<br>input data... so it can't be a MappedClassifier, but if your goal is<br>just to assess such a cross-validation then you could do it with just a<br>bit of coding... let's discuss imho the easiest approach<br><br>I. creating custom sample-attribute based on partitioning and targets<br>   followed by mean_group_sample<br><br>so here would be the code for you to test (and report back) either it<br>does what you want:<br><br>class TestTogetherTrainAlone(Mapper):<br>    def _forward_dataset(self,
 ds):<br>        out = ds.copy()<br>        out.sa['custom'] = ds.sa.partitions.copy()<br>        # 1 is the "training" and 2 is the "testing" we would like to mean<br>        # so let's enforce separate partitions instead of 1<br>        partition1 = ds.sa.partitions == 1<br>        # 10 is just a large enough number > 2 ;)<br>        out.sa.custom[partition1] = 10 + np.arange(np.sum(partition1))<br>        return out<br><br>cv = CrossValidation(ChainMapper(<br>                          [TestTogetherTrainAlone(),<br>                           mean_group_sample(['targets', 'custom']),<br>                     
      CLASSIFIER], space='targets'),<br>                     NFoldPartitioner(1),<br>                     descr='custom-CV')<br><br><br> </div> </div>  </div></body></html>