Skip to main content

StanBKT logo

StanBKT

Documentation Status PyPI CI 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.
  • Works on Linux, macOS and Windows (x86_64 and ARM). pip install stanbkt[tbb] optionally adds TBB where available.
  • 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.

Metadata

Release files for stanbkt 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stanbkt 0.1.4
File Size Uploaded Provenance Actions
stanbkt-0.1.4.tar.gz 90.7 kB Without provenance Details for stanbkt-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for stanbkt 0.1.4
File Interpreter ABI Platform Actions
stanbkt-0.1.4-py3-none-any.whl Python 3 none any Details for stanbkt-0.1.4-py3-none-any.whl

Total release size: 204.6 kB

Release files / stanbkt-0.1.4.tar.gz

Download URL stanbkt-0.1.4.tar.gz
Size 90.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f0bb966ac34495cc83e702a404ed8035005782a18562dc7074ebc11a185d30c0
BLAKE2b-256 checksum
How to use checksums
b410c743510782d8a611b806a93196d2b3844617e4b8e5fc081fd43dcc72359c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / stanbkt-0.1.4-py3-none-any.whl

Download URL stanbkt-0.1.4-py3-none-any.whl
Size 114.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5432344313fe888eb93742f2344fb080b9c4a5d316c163c0d1461e5b2dcbb391
BLAKE2b-256 checksum
How to use checksums
3f2ce6724d200cee313fb8b3fe1a23a757c04dc77e64bd5e2023633b6120e16b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for stanbkt 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page