stanbkt.models.StandardPriors#
- class stanbkt.models.StandardPriors(pi_b0_know_mu=<stanbkt.models.priors._UnsetType object>, pi_b0_know_std=<stanbkt.models.priors._UnsetType object>, pi_b1_know_mu=<stanbkt.models.priors._UnsetType object>, pi_b1_know_std=<stanbkt.models.priors._UnsetType object>, pi_sigma_lambda=<stanbkt.models.priors._UnsetType object>, use_defaults=True, learn_mu=<stanbkt.models.priors._UnsetType object>, learn_std=<stanbkt.models.priors._UnsetType object>, forget_mu=<stanbkt.models.priors._UnsetType object>, forget_std=<stanbkt.models.priors._UnsetType object>, guess_mu=<stanbkt.models.priors._UnsetType object>, guess_std=<stanbkt.models.priors._UnsetType object>, slip_mu=<stanbkt.models.priors._UnsetType object>, slip_std=<stanbkt.models.priors._UnsetType object>, pi_know_mu=<stanbkt.models.priors._UnsetType object>, pi_know_std=<stanbkt.models.priors._UnsetType object>)#
Bases:
PriorsBaseBayesian priors for the Standard BKT model parameters.
Stores prior specifications (means and standard deviations on logit scale) for the four core BKT parameters: prior knowledge (pi_know), learning rate (learn), forgetting rate (forget), guessing (guess), and slipping (slip).
Exclicitly passing None for a parameter indicates an improper and non-informative prior (Stan uses a uniform prior). If all parameters are left as None, the model will use non-informative priors for all parameters, which implies the MAP solllution will be equivalent to maximum likelihood estimation.
Each parameter can be specified as a scalar (standard model), a list of values (grouped model), or None (non-informative priors).
Guess and slip are modeled on the half-logit scale to constrain them to [0, 0.5]. All other parameters are modeled on the logit scale.
- Parameters:
learn_mu (
float|None|_UnsetType) – Prior mean for logit-scale learning rate.learn_std (
float|None|_UnsetType) – Prior std dev for logit-scale learning rate.forget_mu (
float|None|_UnsetType) – Prior mean for logit-scale forgetting rate.forget_std (
float|None|_UnsetType) – Prior std dev for logit-scale forgetting rate.guess_mu (
float|None|_UnsetType) – Prior mean for logit-scale guessing probability.guess_std (
float|None|_UnsetType) – Prior std dev for logit-scale guessing probability.slip_mu (
float|None|_UnsetType) – Prior mean for logit-scale slipping probability.slip_std (
float|None|_UnsetType) – Prior std dev for logit-scale slipping probability.pi_know_mu (
float|None|_UnsetType) – Prior mean for logit-scale initial knowledge probability.pi_know_std (
float|None|_UnsetType) – Prior std dev for logit-scale initial knowledge probability.pi_b0_know_mu (
float|None|_UnsetType) – Prior mean for the intercept (b0) in the linear regression of logit initial knowledge. Used only when estimation_type=:attr: InitKnowledgeStrategy.JOINT.pi_b0_know_std (
float|None|_UnsetType) – Prior std dev for the intercept (b0) in the linear regression of logit initial knowledge. Used only when estimation_type=:attr: stanbkt.models.model_types.InitKnowledgeStrategy.JOINT.pi_b1_know_mu (
float|None|_UnsetType) – Prior mean for the slope (b1) in the linear regression of logit initial knowledge. Used only when estimation_type=:attr: stanbkt.models.model_types.InitKnowledgeStrategy.JOINT.pi_b1_know_std (
float|None|_UnsetType) – Prior std dev for the slope (b1) in the linear regression of logit initial knowledge. Used only when estimation_type=:attr: stanbkt.models.model_types.InitKnowledgeStrategy.JOINT.pi_sigma_lambda (
float|None|_UnsetType) – Prior for the standard deviation of the linear regression residuals. Used only when estimation_type=:attr: stanbkt.models.model_types.InitKnowledgeStrategy.JOINT.use_defaults (
bool) – Whether to fill in missing prior values with defaults (True) or None (False). If True, any parameter not explicitly set will be filled with a default value. If False, any parameter not explicitly set will be set to None, indicating a non-informative uniform prior.
- static expected_class()#
Return the expected BKT model class type for these priors.
- Return type:
- static get_default_priors(estimation_type, return_none=False, n_groups=0)#
Return default priors dictionary used for BKT parameters.
- Parameters:
estimation_type (
InitKnowledgeStrategy) – The strategy used for estimating initial knowledge, which determines which priors are relevant.return_none (
bool) – If True, return a dict with all keys set to None (improper and non-informative). If False, return a dict with default scalar values.n_groups (
int) – The number of groups for grouped models. This is kept here for signature consistency but is not used for the standard priors since the parameters are scalar.
- Return type:
Union[dict[str,float|None],dict[str,list[float|None]]]
Notes
BKT specific priors are modeled as a Normal distributions with means and standard deviations specified on the logit scale for learn and forget probability parameters. Guess and slip are modeled on the half-logit scale to constrain them to [0, 0.5] on the probability scale.
In cases where estimation_type =
stanbkt.models.model_types.InitKnowledgeStrategy.JOINT, the b0 and b1 parameters are modeled as Normal distributions. Additionally, the regression residuals is modeled as a positive-valued parameter (pi_sigma_lambda) with a Exponential prior.A non-centered parameterization is used:
logit_pi_know ~ pi_b0_know + pi_b1_know * pretest + pi_sigma * logit_pi_know_z
- Where,
pi_b0_know ~ Normal(pi_b0_know_mu, pi_b0_know_std)
pi_b1_know ~ Normal(pi_b1_know_mu, pi_b1_know_std)
pi_sigma ~ Exponential(pi_sigma_lambda)
logit_pi_know_z ~ N(0, 1).
This model is mathematically equivalent to:
logit_pi_know ~ Normal(pi_b0_know + pi_b1_know * pretest, pi_sigma)
but the former (non-centered) parameterization is computationally more efficient and has better convergence properties in Stan.
- to_dict(estimation_type)#
Serialize priors to a dictionary.