pyKT is a research benchmark library for deep knowledge tracing. Orchid should not try to replace that model zoo. The practical integration pattern is:
- Use Orchid to normalize adaptive-learning logs.
- Export sequences into pyKT's six-line learner format.
- Train or evaluate a pyKT model in the research stack.
- Bring predicted correctness probabilities back into Orchid for policy ranking, OPE, safety, audit, and deployment.
pyKT's raw sequence format stores each learner in six lines:
- learner id and sequence length
- question ids
- concept ids
- binary responses
- timestamps
- answering durations
from orchid_ranker import export_pykt_sequences
export_pykt_sequences(
interactions,
"data/pykt/orchid_sequences.txt",
user_col="user_id",
item_col="item_id",
correct_col="correct",
concept_col="skill_id",
timestamp_col="timestamp",
duration_col="elapsed_time",
)If concepts, timestamps, or durations are unavailable, Orchid writes NA for
that line's values, matching pyKT's documented raw format.
After training a pyKT model, export a prediction table with one row per user-item probability:
user_id,item_id,p_correct
u1,q1,0.82
u1,q2,0.61
u1,q3,0.74
Then use the adapter anywhere Orchid expects a KT-style predictor:
from orchid_ranker.learning_policy import KTValuePolicy
from orchid_ranker.pykt_bridge import PyKTPredictionAdapter
tracer = PyKTPredictionAdapter.from_csv("pykt_predictions.csv")
policy = KTValuePolicy(tracer, target_correct=0.70)
ranked = policy.rank("u1", ["q1", "q2", "q3"], top_k=3)PyKTPredictionAdapter is static: it does not update a pyKT model online. That
is deliberate. Use it to evaluate and serve exported model probabilities behind
Orchid's policy, OPE, and safety layers. For live learning, retrain/export the
pyKT model on your chosen cadence or use Orchid's native online tracers.
from orchid_ranker.pykt_bridge import load_pykt_sequences, pykt_sequences_to_interactions
sequences = load_pykt_sequences("data/pykt/orchid_sequences.txt")
interactions = pykt_sequences_to_interactions(sequences)This is useful for smoke tests, data audits, and verifying that exported sequence files preserve learner order and response labels.