stanbkt.utils.gq_to_draws#

stanbkt.utils.gq_to_draws(stan_output, data, col_mapping=None, print_fn=None)#

Convert raw CmdStanGQ outputs into long-form draw DataFrames with remapped IDs.

Parameters:
  • stan_output (dict[str, CmdStanGQ]) – Mapping from KC ID to raw CmdStanGQ objects, as returned by predict_posterior_stan or predict_smoothed_posterior_stan.

  • data (DataFrame) – The original student interaction data used for the Stan GQ call. Required to remap Stan integer indices back to actual student/problem IDs.

  • col_mapping (Union[Mapping[ColumnNames, str], Mapping[str, str], Mapping[ColumnNames | str, str], None]) – Column name mapping. If None, the standard ColumnNames defaults are used.

  • print_fn (Optional[Callable[..., None]]) – Optional logging callable. Receives a message string as the first positional argument. Defaults to None (no logging).

Returns:

Mapping from KC ID to draw-level DataFrames suitable for posterior_summary.

Return type:

dict[str, DataFrame]