Beispiel #1
0
 def __call__(self, candidate: BrainModel):
     candidate.start_recording('IT', time_bins=self._time_bins)
     stimulus_set = place_on_screen(
         self._assembly.stimulus_set,
         target_visual_degrees=candidate.visual_degrees(),
         source_visual_degrees=self._visual_degrees)
     # Temporal recordings from large candidates take up a lot of memory and compute time.
     # In order to quickly reject recordings that are static over time,
     # we will show one image and check whether the recordings vary over time at all or not.
     # If they don't we can quickly score the candidate with a failure state
     # since it will not be able to predict temporal differences with the OST metric
     check_stimulus_set = stimulus_set[:1]
     check_stimulus_set.identifier = None  # unset identifier to avoid storing (interferes with actual stimulus_set)
     check_recordings = candidate.look_at(
         check_stimulus_set, number_of_trials=self._number_of_trials)
     if not temporally_varying(check_recordings):
         score = Score([np.nan, np.nan],
                       coords={'aggregation': ['center', 'error']},
                       dims=['aggregation'])
     else:
         recordings = candidate.look_at(
             stimulus_set, number_of_trials=self._number_of_trials)
         score = self._similarity_metric(recordings, self._assembly)
     score = ceil_score(score, self.ceiling)
     return score
Beispiel #2
0
    def __call__(self, model: BrainModel):
        model_identifier = model.identifier
        model.start_recording(self.region, time_bins=self.timebins)
        stim_pos = get_stimulus_position(self._assembly.stimulus_set)
        in_rf = filter_receptive_fields(model_identifier=model_identifier,
                                        model=model,
                                        region=self.region,
                                        pos=stim_pos)

        responses = get_firing_rates(
            model_identifier=model_identifier,
            model=model,
            region=self.region,
            stimulus_identifier=self._assembly.stimulus_set.identifier,
            number_of_trials=self._number_of_trials,
            in_rf=in_rf)
        baseline = get_firing_rates(model_identifier=model_identifier,
                                    model=model,
                                    region=self.region,
                                    stimulus_identifier=BLANK_STIM_NAME,
                                    number_of_trials=self._number_of_trials,
                                    in_rf=in_rf)

        model_property = self._neuronal_property(
            model_identifier=model_identifier,
            responses=responses,
            baseline=baseline)
        raw_score = self._similarity_metric(model_property, self._assembly)
        ceiling = self._ceiling_func(self._assembly)
        return ceil_score(raw_score, ceiling)
Beispiel #3
0
 def __call__(self, candidate: BrainModel):
     time_bins = [(time_bin_start, time_bin_start + 10)
                  for time_bin_start in range(70, 250, 10)]
     candidate.start_recording('IT', time_bins=time_bins)
     recordings = candidate.look_at(self._assembly.stimulus_set)
     score = self._similarity_metric(recordings, self._assembly)
     score = ceil_score(score, self.ceiling)
     return score
Beispiel #4
0
 def __call__(self, candidate: BrainModel):
     time_bins = [(time_bin_start, time_bin_start + 10) for time_bin_start in range(70, 250, 10)]
     candidate.start_recording('IT', time_bins=time_bins)
     stimulus_set = place_on_screen(self._assembly.stimulus_set, target_visual_degrees=candidate.visual_degrees(),
                                    source_visual_degrees=self._visual_degrees)
     recordings = candidate.look_at(stimulus_set)
     score = self._similarity_metric(recordings, self._assembly)
     score = ceil_score(score, self.ceiling)
     return score
Beispiel #5
0
 def __call__(self, candidate: BrainModel):
     candidate.start_recording(self.region, time_bins=self.timebins)
     stimulus_set = place_on_screen(self._assembly.stimulus_set, target_visual_degrees=candidate.visual_degrees(),
                                    source_visual_degrees=self._visual_degrees)
     source_assembly = candidate.look_at(stimulus_set, number_of_trials=self._number_of_trials)
     if 'time_bin' in source_assembly.dims:
         source_assembly = source_assembly.squeeze('time_bin')  # static case for these benchmarks
     raw_score = self._similarity_metric(source_assembly, self._assembly)
     return explained_variance(raw_score, self.ceiling)
Beispiel #6
0
 def __call__(self, candidate: BrainModel, do_behavior=False):
     # Do brain region task
     candidate.start_recording(self.region, time_bins=self.timebins)
     source_assembly = candidate.look_at(self.assembly.stimulus_set)
     # Do behavior task
     if do_behavior:
         candidate.start_task(BrainModel.Task.probabilities,
                              self.assembly.stimulus_set)
         candidate.look_at(self.assembly.stimulus_set)
     raw_score = self._similarity_metric(source_assembly, self.assembly)
     return ceil_score(raw_score, self.ceiling)
 def __call__(self, candidate: BrainModel, do_behavior=False):
     # Check neural recordings
     candidate.start_recording(self.region, time_bins=self.timebins)
     source_assembly = candidate.look_at(self.assembly.stimulus_set)
     # Check behavioral tasks
     if do_behavior:
         candidate.start_task(BrainModel.Task.probabilities,
                              self.assembly.stimulus_set)
         candidate.look_at(self.assembly.stimulus_set)
         candidate.start_task(BrainModel.Task.label, 'imagenet')
         candidate.look_at(self.assembly.stimulus_set)
     raw_score = self._similarity_metric(source_assembly, self.assembly)
     return ceil_score(raw_score, self.ceiling)