knowledgespaces — Knowledge Space Theory for Python¶
A Python library for Knowledge Space Theory (Doignon & Falmagne, 1999) covering the pipeline from item analysis to adaptive assessment.
Structures
Build knowledge structures and spaces from prerequisite relations.
Query Experts
Derive structures by querying human experts or LLMs.
CB-KST
Derive structures from skill maps and competence models.
Assessment
Adaptive assessment with BLIM and Expected Information Gain.
Parameter Estimation
Estimate BLIM parameters from response data via EM.
Command Line
ks inspect, ks query, ks assess for non-programmers.
MCP Server
Use KST via LLM — tools, docs, and guided workflows.
API Reference
Full API documentation generated from source code.
Quick example¶
import knowledgespaces as ks
# Build a knowledge structure
structure = ks.space_from_prerequisites(
["add", "sub", "mul"],
[("add", "sub"), ("sub", "mul")],
)
# Assess a student
result = ks.assess(structure, {"add": True, "sub": True, "mul": False})
print(result["state"]) # {'add', 'sub'}
print(result["outer_fringe"]) # {'mul'} — what to learn next
Install¶
pip install knowledgespaces