Utilities
utils
Functions:
-
choice_from_action_p–Choose an action from a set of action probabilities. Can take probabilities
-
choice_from_action_p_single–Choose an action from a set of action probabilities for a single choice.
choice_from_action_p
Choose an action from a set of action probabilities. Can take probabilities in the form of an n-dimensional array, where the last dimension is the number of actions.
Noise is added to the choice, with probability lapse. This means that
on "lapse" trials, the subject will choose an action uniformly at random.
Parameters:
-
(keyint) –Jax random key
-
(probsndarray) –N-dimension array of action probabilities, of shape (..., n_actions)
-
(lapsefloat, default:0.0) –Probability of lapse. Defaults to 0.0.
Returns: int: Chosen action
Source code in behavioural_modelling/utils.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
choice_from_action_p_single
Choose an action from a set of action probabilities for a single choice.
Parameters:
-
(keyPRNGKey) –Jax random key
-
(probsArrayLike) –1D array of action probabilities, of shape (n_actions)
-
(lapsefloat, default:0.0) –Lapse parameter. On lapse trials, a random action is selected. Defaults to 0.0.
Returns:
-
int(int) –Chosen action
Source code in behavioural_modelling/utils.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |