forked from brain-score/vision
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Kar2018{hvm,cocogray} benchmarks
not all unit tests pass. Precomputed features don't work yet because the StimulusSet differs (see brain-score/brainio_contrib#24), and the later numbers have not yet been run
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import brainscore | ||
from brainscore.benchmarks._neural_common import NeuralBenchmark, average_repetition | ||
from brainscore.metrics.ceiling import InternalConsistency | ||
from brainscore.metrics.regression import CrossRegressedCorrelation, pls_regression, pearsonr_correlation | ||
from brainscore.utils import LazyLoad | ||
|
||
|
||
def DicarloKar2018hvmPLS(): | ||
assembly_repetition = LazyLoad(lambda: load_assembly(stimuli='hvm', average_repetitions=False)) | ||
assembly = LazyLoad(lambda: load_assembly(stimuli='hvm', average_repetitions=True)) | ||
similarity_metric = CrossRegressedCorrelation( | ||
regression=pls_regression(), correlation=pearsonr_correlation(), | ||
crossvalidation_kwargs=dict(stratification_coord='object_name')) | ||
ceiler = InternalConsistency() | ||
return NeuralBenchmark(identifier=f'dicarlo.Kar2018hvm-pls', version=1, | ||
assembly=assembly, similarity_metric=similarity_metric, | ||
ceiling_func=lambda: ceiler(assembly_repetition), | ||
parent='IT', paper_link=None) | ||
|
||
|
||
def DicarloKar2018cocoPLS(): | ||
assembly_repetition = LazyLoad(lambda: load_assembly(stimuli='cocogray', average_repetitions=False)) | ||
assembly = LazyLoad(lambda: load_assembly(stimuli='cocogray', average_repetitions=True)) | ||
similarity_metric = CrossRegressedCorrelation( | ||
regression=pls_regression(), correlation=pearsonr_correlation(), | ||
crossvalidation_kwargs=dict(stratification_coord='label')) | ||
ceiler = InternalConsistency() | ||
return NeuralBenchmark(identifier=f'dicarlo.Kar2018coco-pls', version=1, | ||
assembly=assembly, similarity_metric=similarity_metric, | ||
ceiling_func=lambda: ceiler(assembly_repetition), | ||
parent='IT', paper_link=None) | ||
|
||
|
||
def load_assembly(stimuli, average_repetitions): | ||
assembly = brainscore.get_assembly(name=f'dicarlo.Kar2018{stimuli}') | ||
assembly = assembly.squeeze("time_bin") | ||
assembly.load() | ||
assembly = assembly.transpose('presentation', 'neuroid') | ||
if average_repetitions: | ||
assembly = average_repetition(assembly) | ||
return assembly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters