Ejemplo n.º 1
0
def filter_neuroids(assembly, threshold):
    ceiler = InternalConsistency()
    ceiling = ceiler(assembly)
    ceiling = ceiling.raw
    ceiling = CrossValidation().aggregate(ceiling)
    ceiling = ceiling.sel(aggregation='center')
    pass_threshold = ceiling >= threshold
    assembly = assembly[{'neuroid': pass_threshold}]
    return assembly
Ejemplo n.º 2
0
 def __init__(self, stimulus_coord='stimulus_sentence'):
     self._rdm = RDM()
     self._similarity = RDMSimilarity(comparison_coord=stimulus_coord)
     self._cross_validation = CrossValidation(
         test_size=.9,  # leave 10% out
         split_coord=stimulus_coord,
         stratification_coord=None)
Ejemplo n.º 3
0
    def __init__(self, regression, correlation, crossvalidation_kwargs=None):
        regression = regression or pls_regression()
        crossvalidation_defaults = dict(train_size=.9, test_size=None)
        crossvalidation_kwargs = {
            **crossvalidation_defaults,
            **(crossvalidation_kwargs or {})
        }

        self.cross_validation = CrossValidation(**crossvalidation_kwargs)
        self.regression = regression
        self.correlation = correlation
Ejemplo n.º 4
0
 def test_misaligned(self):
     jumbled_source = NeuroidAssembly(np.random.rand(500, 10),
                                      coords={'image_id': ('presentation', list(reversed(range(500)))),
                                              'image_meta': ('presentation', [0] * 500),
                                              'neuroid_id': ('neuroid', list(reversed(range(10)))),
                                              'neuroid_meta': ('neuroid', [0] * 10)},
                                      dims=['presentation', 'neuroid'])
     target = jumbled_source.sortby(['image_id', 'neuroid_id'])
     cv = CrossValidation(splits=10, stratification_coord=None)
     metric = self.MetricPlaceholder()
     score = cv(jumbled_source, target, apply=metric)
     assert len(metric.train_source_assemblies) == len(metric.test_source_assemblies) == \
            len(metric.train_target_assemblies) == len(metric.test_target_assemblies) == 10
     assert len(score.attrs['raw']) == 10
Ejemplo n.º 5
0
 def __init__(self):
     self._cross_validation = CrossValidation(stratification_coord=None,
                                              splits=10,
                                              test_size=0.1)
     self._i1 = I1()
     self._predicted_osts, self._target_osts = [], []