Example #1
0
def DicarloMajaj2015ITRDM():
    return _DicarloMajaj2015Region(
        'IT',
        identifier_metric_suffix='rdm',
        similarity_metric=RDMCrossValidated(crossvalidation_kwargs=dict(
            stratification_coord='object_name')),
        ceiler=RDMConsistency())
Example #2
0
def MovshonFreemanZiemba2013V2RDM():
    return _MovshonFreemanZiemba2013Region(
        'V2',
        identifier_metric_suffix='rdm',
        similarity_metric=RDMCrossValidated(crossvalidation_kwargs=dict(
            stratification_coord='texture_type')),
        ceiler=RDMConsistency())
Example #3
0
 def __init__(self, *args, **kwargs):
     super(Blank2014fROIRDM, self).__init__(*args, **kwargs)
     self._metric = RDMCrossValidated(
         comparison_coord='stimulus_id',
         crossvalidation_kwargs=dict(split_coord='stimulus_id', stratification_coord=None, splits=5,
                                     kfold=True, test_size=None))
     self._ceiler.extrapolation_dimension = 'subject_UID'
     self._cross = CartesianProduct(dividers=['subject_UID'])
Example #4
0
 def __init__(self, **kwargs):
     metric = RDMCrossValidated(comparison_coord='stimulus_id',
                                crossvalidation_kwargs=dict(
                                    split_coord='stimulus_id',
                                    stratification_coord=None,
                                    splits=5,
                                    kfold=True,
                                    test_size=None))
     super(PereiraRDM, self).__init__(metric=metric, **kwargs)
Example #5
0
 def __init__(self, identifier):
     metric = RDMCrossValidated(
         comparison_coord='stimulus_id',
         crossvalidation_kwargs=dict(split_coord='stimulus_id', stratification_coord='sentence_id',
                                     # doesn't work because train_size is deemed too small.
                                     # even though `train` is not needed, CrossValidation still splits it that way
                                     splits=5, kfold=True, test_size=None))
     super(Fedorenko2016V3RDM, self).__init__(identifier=identifier, metric=metric)
     self._ceiler.extrapolation_dimension = 'subject_UID'
     self._cross = CartesianProduct(dividers=['subject_UID'])
Example #6
0
 def __init__(self, identifier):
     metric = RDMCrossValidated(
         comparison_coord='stimulus_id',
         crossvalidation_kwargs=dict(
             split_coord='stimulus_id',
             stratification_coord='sentence_id',
             # doesn't work because train_size is deemed too small.
             # even though `train` is not needed, CrossValidation still splits it that way
             splits=5,
             kfold=True,
             test_size=None))
     super(Fedorenko2016V3RDM, self).__init__(identifier=identifier,
                                              metric=metric)
Example #7
0
 def test_small(self):
     assembly = NeuroidAssembly(
         (np.arange(30 * 25) + np.random.standard_normal(30 * 25)).reshape(
             (30, 25)),
         coords={
             'image_id': ('presentation', np.arange(30)),
             'object_name': ('presentation', ['a', 'b', 'c'] * 10),
             'neuroid_id': ('neuroid', np.arange(25)),
             'region': ('neuroid', [None] * 25)
         },
         dims=['presentation', 'neuroid'])
     metric = RDMCrossValidated()
     score = metric(assembly1=assembly, assembly2=assembly)
     assert score.sel(aggregation='center') == approx(1)
Example #8
0
def AruCichy2019RDM():
    assembly = LazyLoad(lambda: load_assembly(average_repetitions=False))

    similarity_metric = RDMCrossValidated(crossvalidation_kwargs=dict(
        stratification_coord=None))
    ceiler = RDMConsistency()

    ceiling = Score([1, np.nan],
                    coords={'aggregation': ['center', 'error']},
                    dims=['aggregation'])
    return RDMBenchmark(identifier=f'aru.Cichy2019-rdm',
                        version=1,
                        assembly=assembly,
                        similarity_metric=similarity_metric,
                        visual_degrees=VISUAL_DEGREES,
                        ceiling_func=lambda: ceiling,
                        parent='Kamila',
                        number_of_trials=1,
                        region='IT',
                        time_bins=[(62.5, 156.2)])
Example #9
0
def AruKuzovkin2018PLS():
    assembly_repetition = LazyLoad(
        lambda: load_assembly(average_repetitions=False))
    assembly = LazyLoad(lambda: load_assembly(average_repetitions=True))

    # similarity_metric = CrossRegressedCorrelation(
    #     regression=pls_regression(),
    #     correlation=pearsonr_correlation(),
    #     crossvalidation_kwargs=dict(stratification_coord=None)
    # )

    similarity_metric = RDMCrossValidated(crossvalidation_kwargs=dict(
        stratification_coord=None))

    # sub-select the entire IT region
    # x = assembly['region']
    # idx = x.data == 20

    # sub-select only important it electrodes for IT: 1094
    # idx = np.zeros((len(assembly.neuroid_id)), dtype=bool)
    # idx[1094] = True
    # idx[847] = True

    #idx = get_IT_MNI()
    idx = it_idx

    new_assembly = assembly[:, idx, :]

    # Can replace the "name" of the brain region
    new_assembly = type(new_assembly)(
        new_assembly.values,
        coords={
            coord: (dims, values if coord != 'region' else ['IT'] *
                    len(new_assembly['region']))
            for coord, dims, values in walk_coords(new_assembly)
        },
        dims=new_assembly.dims)

    new_assembly.attrs = assembly.attrs

    new_assembly = new_assembly.where(new_assembly['time_bin_start'] < 350,
                                      drop=True)
    new_assembly = new_assembly.where(new_assembly['time_bin_start'] > 250,
                                      drop=True)
    new_assembly = new_assembly.mean('time_bin')
    new_assembly = new_assembly.expand_dims('time_bin')
    new_assembly.coords['time_bin'] = pd.MultiIndex.from_tuples(
        [(62.5, 156.2)], names=['time_bin_start', 'time_bin_end'])
    new_assembly = new_assembly.squeeze('time_bin')

    new_assembly.attrs = assembly.attrs

    ceiling = Score([1, np.nan],
                    coords={'aggregation': ['center', 'error']},
                    dims=['aggregation'])
    return NeuralBenchmark(identifier=f'aru.Kuzovkin2018-pls',
                           version=1,
                           assembly=new_assembly,
                           similarity_metric=similarity_metric,
                           visual_degrees=VISUAL_DEGREES,
                           ceiling_func=lambda: ceiling,
                           parent='Kamila',
                           number_of_trials=1)