Hi all,
Thanks in advance for any help. This may be long. My set up is quite similar to the one defined here Fitting a value-based decision model with trial-level context variables .
The model I am using predicts fixation paths for each trial. The model has three free parameters, yet the output also depends on two context variables, namely attributeValues (6 value array per trial) which vary across trials and attributeWeights a vector of 3 which is subject specific but the same across trials.My ultimate goal is to estimate the three free parameters per subject (50 subjects), from 420 trials per trial.
My meta_fn picks a random number of trials.
def determine_n_trials(batch_size):
# N: number of observation in a dataset
n_trials = np.random.randint(120, 450)
return dict(n_trials = n_trials)
and I have another function which samples attributeValues and attributeWeights (determine_attVal(n_trials)).
Together they make my simulator
simulator = bf.make_simulator([determine_attVal, prior, modelFunc], meta_fn=determine_n_trials)
Using out = simulator.sample(5), returns the followingâŚ
n_trials: no .shape attribute (type = <class âintâ>)
attValues: shape = (5, 292, 6)
attWeights: shape = (5, 3)
sn: shape = (5, 1)
threshInc: shape = (5, 1)
searchSense: shape = (5, 1)
choice: shape = (5, 292)
RT: shape = (5, 292)
allFix: shape = (5, 292, 100)
sn, threshInc and searchSense are the free parameters, while choice, RT and âallFixâ are the output of the model. For now, I am just using allFix as a summary_variable. The third dimension of allFix is the number of fixations. The model can produce a maximum of 100 fixations per trial.
From the discussion in the other post, I thought that attWeights, should be an inference condition and attValues should be part of summary_variables.
adapter = (
bf.adapters.Adapter()
.broadcast(ân_trialsâ, to=âRTâ)
.convert_dtype(âfloat64â, âfloat32â)
.concatenate([âsnâ,âthreshIncâ,âsearchSenseâ], into=âinference_variablesâ)
.concatenate([âattWeightsâ,ân_trialsâ], into=âinference_conditionsâ)
.concatenate([âallFixâ,âattValuesâ],into=âsummary_variablesâ)
)
However, since âallFixâ contains fixation paths, I am using a TimeSeriesNetwork as the summary_network to ensure the order does not get lost. Not sure if this is the right choice. The order of attWeights and attValues is also important as they enter the model.
Online fitting runs (loss is huge but still decreasing). My main question is about the adapter: is this the right way of setting things up in my case and is a TimeSeriesNetwork appropriate here? Also, if I want to also use RT and choice as summary_variables (along with allFix), is this still an appropriate netwrok?
Thanks so much, I apologise in advance for the essay.