stanbkt.plot#
Functions
|
Plot posterior distributions for selected fit parameters. |
|
Plot posterior predictions of correctness for a given KC. |
|
Plot MCMC trace diagnostics for selected fit parameters. |
API Details
Plot the posterior distributions for the BKT parameters and quantities of interest.
- stanbkt.plot.plot_dist(fit, params=None, *, ci_prob=None, ci_kind=None, col_wrap=3)#
Plot posterior distributions for selected fit parameters.
- Parameters:
fit (
Any) – CmdStanPy fit object for one KC.params (
Sequence[str] |None) – Parameter names to plot. IfNone, all posterior parameters are plotted.ci_prob (
float|None) – Probability mass to display in the credible interval.ci_kind (
str|None) – Credible interval type passed to ArviZ, such as"hdi"or"eti".col_wrap (
int) – Number of columns before wrapping to a new row.
- Returns:
ArviZ plot object for the requested posterior parameters.
- Return type:
- stanbkt.plot.plot_posterior_correctness(posterior_pred_kc, data, kc, grouped=False, type='preds', point_estimate='mean', *, percentiles=(2.5, 97.5), problem_ids=None, trajectory=False, frac=1.0, column_mapping={}, offset=0)#
Plot posterior predictions of correctness for a given KC.
- Parameters:
posterior_pred_kc (
DataFrame) – Posterior predictions for the selected KC.data (
DataFrame) – Input data containing student interactions.kc (
str) – The KC for which to plot posterior predictions.grouped (
bool) – Whether to produce one subplot per group using the group column from column_mapping (or group_id by default). If True, the group column is required in data.type (
Literal['probs','preds']) – Whether the posterior predictions are probabilities (“probs”) or binary predictions (“preds”).point_estimate (
Literal['mean','median','mode']) – The point estimate to display for each problem. Can be “mean”, “median”, or “mode”.problem_ids (
Optional[list[str]]) – List of problem IDs to include in the plot. If None, all problems for the KCtrajectory (
bool) – Whether to connect the data points with a line to show the trajectory across problems. Default is False.percentiles (
tuple[float,float]) – The lower and upper percentiles to display as error bars. Values should be in range [1, 99].frac (float, optional) – Fraction of problems to use for plotting. The problems will be linearly spaced. Useful for large datasets to reduce overplotting.
col_mapping (dict, optional) – Mapping of expected column names. Keys should be ‘student_id’, ‘problem_id’, ‘correct’, and ‘kc_id’. If None, default column names are used.
offset (
float) – Horizontal offset to apply to the posterior predictions for better visibility when plotted alongside data points.column_mapping (Mapping[ColumnNames, str] | Mapping[str, str] | Mapping[ColumnNames | str, str])
- Returns:
A single axis for ungrouped data, or an array of subplot axes (one per group) when grouped data is provided.
- Return type:
- stanbkt.plot.plot_trace(fit, params=None, *, col_wrap=3)#
Plot MCMC trace diagnostics for selected fit parameters.
- Parameters:
- Returns:
ArviZ plot object returned by
arviz.plot_trace.- Return type: