aind_dynamic_foraging_models.generative_model.params package¶
Submodules¶
aind_dynamic_foraging_models.generative_model.params.forager_loss_counting_params module¶
Generate pydantic models for Loss Count agent parameters.
- aind_dynamic_foraging_models.generative_model.params.forager_loss_counting_params.generate_pydantic_loss_counting_params(win_stay_lose_switch: Literal[False, True] = False, choice_kernel: Literal['none', 'one_step', 'full'] = 'none') Tuple[Type[BaseModel], Type[BaseModel]][source]¶
Generate Pydantic models for Loss-counting agent parameters.
All default values are hard-coded in this function. But when instantiating the model, you can always override the default values, both the params and the fitting bounds.
- Parameters:
win_stay_lose_switch (bool, optional) – If True, the agent will be a win-stay-lose-shift agent (loss_count_threshold_mean and loss_count_threshold_std are fixed at 1 and 0), by default False
choice_kernel (Literal["none", "one_step", "full"], optional) –
Choice kernel type, by default “none” If “none”, no choice kernel will be included in the model. If “one_step”, choice_kernel_step_size will be set to 1.0, i.e., only the previous choice
affects the choice kernel. (Bari2019)
If “full”, both choice_kernel_step_size and choice_kernel_relative_weight will be included
aind_dynamic_foraging_models.generative_model.params.forager_q_learning_params module¶
Dynamically generate pydantic models for Q-learning agent parameters.
- aind_dynamic_foraging_models.generative_model.params.forager_q_learning_params.generate_pydantic_q_learning_params(number_of_learning_rate: Literal[1, 2] = 2, number_of_forget_rate: Literal[0, 1] = 1, choice_kernel: Literal['none', 'one_step', 'full'] = 'none', action_selection: Literal['softmax', 'epsilon-greedy'] = 'softmax') Tuple[Type[BaseModel], Type[BaseModel]][source]¶
Dynamically generate Pydantic models for Q-learning agent parameters.
All default values are hard-coded in this function. But when instantiating the model, you can always override the default values, both the params_fields and the fitting bounds.
- Parameters:
number_of_learning_rate (Literal[1, 2], optional) – Number of learning rates, by default 2 If 1, only one learn_rate will be included in the model. If 2, learn_rate_rew and learn_rate_unrew will be included in the model.
number_of_forget_rate (Literal[0, 1], optional) – Number of forget_rates, by default 1. If 0, forget_rate_unchosen will not be included in the model. If 1, forget_rate_unchosen will be included in the model.
choice_kernel (Literal["none", "one_step", "full"], optional) –
Choice kernel type, by default “none” If “none”, no choice kernel will be included in the model. If “one_step”, choice_kernel_step_size will be set to 1.0, i.e., only the previous choice
affects the choice kernel. (Bari2019)
If “full”, both choice_kernel_step_size and choice_kernel_relative_weight will be included
action_selection (Literal["softmax", "epsilon-greedy"], optional) – Action selection type, by default “softmax”
aind_dynamic_foraging_models.generative_model.params.util module¶
- aind_dynamic_foraging_models.generative_model.params.util.create_pydantic_models_dynamic(params_fields: Dict[str, Any], fitting_bounds: Dict[str, Tuple[float, float]])[source]¶
Create Pydantic models dynamically based on the input fields and fitting bounds.
- aind_dynamic_foraging_models.generative_model.params.util.get_params_options(params_model, default_range=[-inf, inf], para_range_override={}) dict[source]¶
Get options for the params fields.
Useful for the Streamlit app.
- Parameters:
params_model (Pydantic model) – The Pydantic model for the parameters.
default_range (list, optional) – The default range for the parameters, by default [-np.inf, np.inf] If the range is not specified in the Pydantic model, this default range will be used.
para_range_override (dict, optional) – The range override for user-specified parameters, by default {}
Example
ParamsModel (>>>) –
- number_of_learning_rate=1,
number_of_forget_rate=1, choice_kernel=”one_step”, action_selection=”softmax”,
)
generate_pydantic_q_learning_params( (FittingBoundsModel =) –
- number_of_learning_rate=1,
number_of_forget_rate=1, choice_kernel=”one_step”, action_selection=”softmax”,
)
get_params_options(ParamsModel) (>>> params_options =)
{'learn_rate' ({'para_range': [0.0, 1.0],) – ‘para_default’: 0.5, ‘para_symbol’: <ParamsSymbols.learn_rate: ‘$alpha$’>, ‘para_desc’: ‘Learning rate’}, …
}
Module contents¶
Package for params
- class aind_dynamic_foraging_models.generative_model.params.ParamsSymbols(value)[source]¶
Bases:
str,EnumSymbols for the parameters.
The order determined the default order of parameters when output as a string.
- biasL = '$b_L$'¶
- choice_kernel_relative_weight = '$w_{ck}$'¶
- choice_kernel_step_size = '$\\alpha_{ck}$'¶
- epsilon = '$\\epsilon$'¶
- forget_rate_unchosen = '$\\delta$'¶
- learn_rate = '$\\alpha$'¶
- learn_rate_rew = '$\\alpha_{rew}$'¶
- learn_rate_unrew = '$\\alpha_{unr}$'¶
- loss_count_threshold_mean = '$\\mu_{LC}$'¶
- loss_count_threshold_std = '$\\sigma_{LC}$'¶
- reset_to_threshold = '$\\mathrm{reset}$'¶
- softmax_inverse_temperature = '$\\beta$'¶
- threshold = '$\\rho$'¶