brain-score / model-tools

Helper functions to extract model activations and translate from Machine Learning to Neuroscience
MIT License
8 stars 27 forks source link

accept number_of_trials in look_at (and ignore) #38

Closed mschrimpf closed 3 years ago

mschrimpf commented 3 years ago

see https://github.com/brain-score/brain-score/pull/235

mschrimpf commented 3 years ago

@tiagogmarques would this allow the stochastic models to deal with multiple trials? When we last talked about this solution, we thought you could do:

def look_at(self, stimuli, number_of_trials):
    trials = []
    for trial_number in range(number_of_trials):
        trial = super().look_at(stimuli, number_of_trials=1)  # need to avoid re-using previously cached results
        trial['repetition'] = 'presentation', [trial_number] * len(trial['presentation'])
        trials.append(trial)
    trials = merge_data_arrays(trial)
    trials = trials.mean('repetition')
    return trials

but I suspect this will run into the same memory issues this PR is trying to resolve -- so perhaps instead you could use a running average?