Predict circular estimate statistics¶
author: steeve laquitaine
This tutorial simulates the statistics (mean and standard deviations) of the circular estimate predictions generated by a cardinal Bayesian model.
Setup¶
[2]:
# go to the project's root path
import os
os.chdir("..")
[3]:
# import dependencies
from bsfit.nodes.models.bayes import CardinalBayes
from bsfit.nodes.dataEng import (
simulate_dataset,
)
from matplotlib import pyplot as plt
%load_ext autoreload
%autoreload 2
The autoreload extension is already loaded. To reload it, use:
%reload_ext autoreload
Set the parameters¶
[4]:
# set the parameters
PRIOR_SHAPE = "vonMisesPrior"
PRIOR_MODE = 225
OBJ_FUN = "maxLLH"
READOUT = "map"
PRIOR_NOISE = [80, 40] # e.g., prior's std
STIM_NOISE = [0.33, 0.66, 1.0]
SIM_P = {
"k_llh": [2.7, 10.7, 33],
"k_prior": [2.7, 33],
"k_card": [2000],
"prior_tail": [0],
"p_rand": [0],
"k_m": [2000],
}
GRANULARITY = "mean"
CENTERING = True
Simulate a dataset¶
[5]:
# simulate a training dataset
train_dataset = simulate_dataset(
stim_noise=STIM_NOISE,
prior_mode=PRIOR_MODE,
prior_noise=PRIOR_NOISE,
prior_shape=PRIOR_SHAPE,
)
Simulate the model mean predictions¶
[7]:
# instantiate the model
model = CardinalBayes(
initial_params=SIM_P,
prior_shape=PRIOR_SHAPE,
prior_mode=PRIOR_MODE,
readout=READOUT
)
# simulate predictions
plt.figure(figsize=(15,5))
model = model.simulate(
dataset=train_dataset,
granularity=GRANULARITY,
centering=CENTERING,
)
Running simulation ...
Calculating predictions ...
-logl:2537.18, aic:5092.36, kl:[ 2.7 10.7 33. ], kp:[ 2.7 33. ], kc:[2000.], pt:0.00, pr:0.00, km:2000.00

Tutorial complete !