Skip to main content

Add your description here

Project description

StanBKT logo

StanBKT

Documentation Status PyPI License: MIT

Overview

StanBKT is a Python package for fitting Bayesian Knowledge Tracing (BKT) models with Stan (https://mc-stan.org/). It is designed for educational data in long format (student interactions over time) and provides tools for:

  • fitting standard and grouped BKT models,
  • generating hidden-knowledge predictions,
  • simulation utilities for synthetic BKT datasets,
  • and plotting/posterior analysis workflows.

Documentation

Full user docs, API reference, and examples are available at:

https://stanbkt.readthedocs.io/

Installation

StanBKT requires Python 3.12+.

Install from PyPI:

pip install stanbkt

Or with uv:

uv add stanbkt

One-time setup (CmdStan)

After installing StanBKT, run the CmdStan setup once on each machine:

from stanbkt.utils import setup_cmdstanpy

# Adjust n_cores for your machine
setup_cmdstanpy(n_cores=4)

This installs/configures CmdStan so model compilation and fitting can run.

Quick Start

from stanbkt.models import StandardBKT
from stanbkt.utils import sim_simple_BKT

# 1) Generate synthetic interaction data
data = sim_simple_BKT(n_students=100, n_problems=30, n_kcs=3, rng_seed=42)

# 2) Fit a BKT model
model = StandardBKT()
model.fit(data)

# 3) Predict latent knowledge and correctness probabilities
pred = model.predict(data)
print(pred.head())

Expected prediction columns include:

  • kc_id
  • student_id
  • problem_id
  • pKnow
  • pCorrectness
  • correct

Data Format

StanBKT expects interaction data in long format with these columns:

  • student_id
  • problem_id
  • correct (0/1)
  • timestamp or other ordering field
  • kc_id (optional; if omitted, all rows are treated as one KC)

If your dataset uses different column names, pass a column_mapping dictionary to fit and predict.

Notes

  • StanBKT uses CmdStanPy under the hood.
  • If you use Windows, review the installation notes in the docs for compiler/toolchain setup.
  • Running Stan-based inference can take time on first compile.

License

See the LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stanbkt-0.1.2.tar.gz (77.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stanbkt-0.1.2-py3-none-any.whl (105.8 kB view details)

Uploaded Python 3

File details

Details for the file stanbkt-0.1.2.tar.gz.

File metadata

  • Download URL: stanbkt-0.1.2.tar.gz
  • Upload date:
  • Size: 77.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.25

File hashes

Hashes for stanbkt-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4aeaa73d4055db75ead6399fda2cd23a72f43f6d71a3d0419978c87630365172
MD5 c9c24d7fc40840d61518a572a1ca4307
BLAKE2b-256 5b31471342c57fe47dafae7305bdbada4c4d745faa273799d2149ae985852523

See more details on using hashes here.

File details

Details for the file stanbkt-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: stanbkt-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 105.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.25

File hashes

Hashes for stanbkt-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5de235e6fa1d7c2cf82d4ecdc438839d3eb705be2469275660ab7418d5aaf2e8
MD5 7a797bf29c9e0f2f64c82cbdba2cdae7
BLAKE2b-256 c59025e3b42dce544bf760763a5a92b877607d13c2244b9adab5695b48c58050

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page