Education Learning Analytics Modeling
Goal
Turn education platform/log/behavior data into interpretable learning analytics models and paper-ready results.
Use After
Use after:
education-learning-analytics-design
education-sampling-data-management
education-quantitative-data-cleaning
education-descriptive-statistics
education-advanced-quantitative-modeling
Do not expose the skill name to users. Present it as "学习行为数据建模" or "学习分析建模".
Inputs
- Cleaned log or learning behavior dataset
- Data dictionary
- Unit of analysis: student, session, event, item, assignment, time window
- Outcome: achievement, completion, engagement, dropout risk, mastery, writing improvement
- Time window and prediction target
- Privacy/anonymization constraints
Workflow
- Define modeling objective:
- descriptive behavior analysis
- clustering/learner profiles
- prediction/early warning
- knowledge tracing/mastery estimation
- sequence/pathway analysis
- intervention/effect analysis
- Define unit and time window:
- event-level
- session-level
- student-week
- student-course
- item/knowledge component
- Check data leakage:
- features must occur before prediction target
- no future outcome information in predictors
- separate training/test by student or time where appropriate
- Engineer features:
- frequency/count
- duration/time-on-task
- recency
- regularity
- completion
- revision behavior
- help-seeking
- AI prompt/feedback usage
- assessment history
- knowledge component performance
- Choose model:
- descriptive dashboards
- k-means/hierarchical clustering/GMM/HDBSCAN
- logistic/linear regression
- random forest/gradient boosting
- sequence models
- Bayesian knowledge tracing/deep knowledge tracing when appropriate
- Split/evaluate:
- train/test split
- cross-validation
- time-based validation
- student-level split
- Evaluate metrics:
- classification: accuracy, precision, recall, F1, AUC
- regression: MAE, RMSE, R2
- clustering: silhouette, stability, interpretability
- knowledge tracing: AUC, calibration, mastery curve
- Interpret model:
- feature importance
- SHAP/permutation importance
- profile descriptions
- educational meaning
- Produce figures/tables and result narrative.
Tool Calls
Python
pip install pandas numpy scikit-learn statsmodels seaborn matplotlib shap xgboost lightgbm umap-learn hdbscan lifelines
Feature aggregation:
features = (
logs.groupby("student_id")
.agg(
n_sessions=("session_id", "nunique"),
n_events=("event_id", "count"),
total_time=("duration_sec", "sum"),
avg_score=("score", "mean"),
n_ai_feedback=("ai_feedback_used", "sum")
)
.reset_index()
)
Prediction:
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import classification_report, roc_auc_score
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.2, stratify=y, random_state=42)
model = RandomForestClassifier(random_state=42)
model.fit(X_train, y_train)
pred = model.predict(X_test)
proba = model.predict_proba(X_test)[:, 1]
print(classification_report(y_test, pred))
print(roc_auc_score(y_test, proba))
Clustering:
from sklearn.preprocessing import StandardScaler
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_score
X_scaled = StandardScaler().fit_transform(X)
km = KMeans(n_clusters=3, random_state=42).fit(X_scaled)
silhouette_score(X_scaled, km.labels_)
SHAP:
import shap
explainer = shap.TreeExplainer(model)
shap_values = explainer.shap_values(X_test)
R
install.packages(c("tidyverse", "tidymodels", "caret", "cluster", "factoextra", "TraMineR", "lme4"))
Feature aggregation:
features <- logs |>
group_by(student_id) |>
summarise(
n_sessions = n_distinct(session_id),
n_events = n(),
total_time = sum(duration_sec, na.rm = TRUE),
avg_score = mean(score, na.rm = TRUE),
n_ai_feedback = sum(ai_feedback_used, na.rm = TRUE)
)
Sequence analysis:
install.packages("TraMineR")
library(TraMineR)
Knowledge Tracing Tools
pyBKT: https://github.com/CAHLR/pyBKT
pyKT: https://github.com/pykt-team/pykt-toolkit
EduKTM: https://github.com/bigdata-ustc/EduKTM
Install examples:
pip install pyBKT
Use knowledge tracing only when data include repeated item/skill/knowledge-component interactions.
Output Format
1. Modeling Objective
| Objective |
Outcome |
Unit |
Time Window |
Model Family |
2. Feature Table
| Feature |
Definition |
Time Window |
Source |
Leakage Risk |
Educational Meaning |
3. Model Plan
| Model |
Purpose |
Inputs |
Evaluation Metric |
Interpretation Method |
4. Results Table
| Model |
Metric |
Value |
Baseline Comparison |
Interpretation |
5. Learner Profile Table
| Cluster/Profile |
Behavioral Pattern |
Size |
Outcome Pattern |
Teaching Implication |
6. Knowledge Tracing Table
| Knowledge Component |
Initial Mastery |
Learning Rate |
Guess/Slip |
Interpretation |
7. Reporting Template
基于学习平台日志,本研究构建了 [特征数量] 个学习行为特征,涵盖学习频率、学习持续时间、任务完成、AI 反馈使用和测验表现等维度。模型以 [结果变量] 为预测目标,采用 [模型] 进行分析。结果显示,模型在测试集上的 [指标] 为 [数值],其中 [重要特征] 对预测贡献较大。该结果表明 [教育解释]。
Education-Specific Feature Ideas
| Context |
Features |
| AI writing platform |
prompt count, feedback accepted, revision count, draft length change, time between drafts |
| LMS course |
login frequency, video completion, quiz attempts, assignment lateness, forum posts |
| Intelligent tutoring |
item attempts, hints requested, skill mastery, response time, error patterns |
| Reading platform |
reading duration, pages completed, annotation count, comprehension score |
| Teacher dashboard |
feedback frequency, grading turnaround, intervention notes |
Quality Rules
- Prediction is not explanation unless interpreted carefully.
- Avoid leakage from future behavior or final outcomes.
- Split data at the student level when repeated events exist.
- Report class imbalance and baseline models.
- Prefer interpretable models for educational decision-making.
- Do not label students in stigmatizing ways; use supportive profile names.
- Preserve privacy for logs, prompts, writing samples, and account identifiers.
User-Facing Closure
End by asking for the modeling objective:
学习行为数据可以进入建模阶段。你更想先做哪类分析:A. 学习者画像/聚类,B. 成绩或风险预测,C. 知识掌握追踪,D. AI 使用行为与写作改进关系?如果你不确定,我会根据数据字段推荐。
1---2name: education-learning-analytics-modeling3description: Use after learning analytics or educational data mining data are available and cleaned, especially LMS logs, AI platform logs, clickstream, assignment histories, assessment sequences, student writing revision traces, knowledge component data, and learning behavior records. Covers feature engineering, sequence analysis, clustering, prediction, early warning, knowledge tracing, model evaluation, explainability, leakage checks, privacy, and education-paper reporting.4---56# Education Learning Analytics Modeling78## Goal910Turn education platform/log/behavior data into interpretable learning analytics models and paper-ready results.1112## Use After1314Use after:1516- `education-learning-analytics-design`17- `education-sampling-data-management`18- `education-quantitative-data-cleaning`19- `education-descriptive-statistics`20- `education-advanced-quantitative-modeling`2122Do not expose the skill name to users. Present it as "学习行为数据建模" or "学习分析建模".2324## Inputs2526- Cleaned log or learning behavior dataset27- Data dictionary28- Unit of analysis: student, session, event, item, assignment, time window29- Outcome: achievement, completion, engagement, dropout risk, mastery, writing improvement30- Time window and prediction target31- Privacy/anonymization constraints3233## Workflow34351. Define modeling objective:36 - descriptive behavior analysis37 - clustering/learner profiles38 - prediction/early warning39 - knowledge tracing/mastery estimation40 - sequence/pathway analysis41 - intervention/effect analysis422. Define unit and time window:43 - event-level44 - session-level45 - student-week46 - student-course47 - item/knowledge component483. Check data leakage:49 - features must occur before prediction target50 - no future outcome information in predictors51 - separate training/test by student or time where appropriate524. Engineer features:53 - frequency/count54 - duration/time-on-task55 - recency56 - regularity57 - completion58 - revision behavior59 - help-seeking60 - AI prompt/feedback usage61 - assessment history62 - knowledge component performance635. Choose model:64 - descriptive dashboards65 - k-means/hierarchical clustering/GMM/HDBSCAN66 - logistic/linear regression67 - random forest/gradient boosting68 - sequence models69 - Bayesian knowledge tracing/deep knowledge tracing when appropriate706. Split/evaluate:71 - train/test split72 - cross-validation73 - time-based validation74 - student-level split757. Evaluate metrics:76 - classification: accuracy, precision, recall, F1, AUC77 - regression: MAE, RMSE, R278 - clustering: silhouette, stability, interpretability79 - knowledge tracing: AUC, calibration, mastery curve808. Interpret model:81 - feature importance82 - SHAP/permutation importance83 - profile descriptions84 - educational meaning859. Produce figures/tables and result narrative.8687## Tool Calls8889### Python9091```bash92pip install pandas numpy scikit-learn statsmodels seaborn matplotlib shap xgboost lightgbm umap-learn hdbscan lifelines93```9495Feature aggregation:9697```python98features = (99 logs.groupby("student_id")100 .agg(101 n_sessions=("session_id", "nunique"),102 n_events=("event_id", "count"),103 total_time=("duration_sec", "sum"),104 avg_score=("score", "mean"),105 n_ai_feedback=("ai_feedback_used", "sum")106 )107 .reset_index()108)109```110111Prediction:112113```python114from sklearn.model_selection import train_test_split, cross_val_score115from sklearn.ensemble import RandomForestClassifier116from sklearn.metrics import classification_report, roc_auc_score117118X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.2, stratify=y, random_state=42)119model = RandomForestClassifier(random_state=42)120model.fit(X_train, y_train)121pred = model.predict(X_test)122proba = model.predict_proba(X_test)[:, 1]123print(classification_report(y_test, pred))124print(roc_auc_score(y_test, proba))125```126127Clustering:128129```python130from sklearn.preprocessing import StandardScaler131from sklearn.cluster import KMeans132from sklearn.metrics import silhouette_score133134X_scaled = StandardScaler().fit_transform(X)135km = KMeans(n_clusters=3, random_state=42).fit(X_scaled)136silhouette_score(X_scaled, km.labels_)137```138139SHAP:140141```python142import shap143explainer = shap.TreeExplainer(model)144shap_values = explainer.shap_values(X_test)145```146147### R148149```r150install.packages(c("tidyverse", "tidymodels", "caret", "cluster", "factoextra", "TraMineR", "lme4"))151```152153Feature aggregation:154155```r156features <- logs |>157 group_by(student_id) |>158 summarise(159 n_sessions = n_distinct(session_id),160 n_events = n(),161 total_time = sum(duration_sec, na.rm = TRUE),162 avg_score = mean(score, na.rm = TRUE),163 n_ai_feedback = sum(ai_feedback_used, na.rm = TRUE)164 )165```166167Sequence analysis:168169```r170install.packages("TraMineR")171library(TraMineR)172```173174### Knowledge Tracing Tools175176```text177pyBKT: https://github.com/CAHLR/pyBKT178pyKT: https://github.com/pykt-team/pykt-toolkit179EduKTM: https://github.com/bigdata-ustc/EduKTM180```181182Install examples:183184```bash185pip install pyBKT186```187188Use knowledge tracing only when data include repeated item/skill/knowledge-component interactions.189190## Output Format191192### 1. Modeling Objective193194| Objective | Outcome | Unit | Time Window | Model Family |195|---|---|---|---|---|196197### 2. Feature Table198199| Feature | Definition | Time Window | Source | Leakage Risk | Educational Meaning |200|---|---|---|---|---|---|201202### 3. Model Plan203204| Model | Purpose | Inputs | Evaluation Metric | Interpretation Method |205|---|---|---|---|---|206207### 4. Results Table208209| Model | Metric | Value | Baseline Comparison | Interpretation |210|---|---|---|---|---|211212### 5. Learner Profile Table213214| Cluster/Profile | Behavioral Pattern | Size | Outcome Pattern | Teaching Implication |215|---|---|---|---|---|216217### 6. Knowledge Tracing Table218219| Knowledge Component | Initial Mastery | Learning Rate | Guess/Slip | Interpretation |220|---|---|---|---|---|221222### 7. Reporting Template223224```text225基于学习平台日志,本研究构建了 [特征数量] 个学习行为特征,涵盖学习频率、学习持续时间、任务完成、AI 反馈使用和测验表现等维度。模型以 [结果变量] 为预测目标,采用 [模型] 进行分析。结果显示,模型在测试集上的 [指标] 为 [数值],其中 [重要特征] 对预测贡献较大。该结果表明 [教育解释]。226```227228## Education-Specific Feature Ideas229230| Context | Features |231|---|---|232| AI writing platform | prompt count, feedback accepted, revision count, draft length change, time between drafts |233| LMS course | login frequency, video completion, quiz attempts, assignment lateness, forum posts |234| Intelligent tutoring | item attempts, hints requested, skill mastery, response time, error patterns |235| Reading platform | reading duration, pages completed, annotation count, comprehension score |236| Teacher dashboard | feedback frequency, grading turnaround, intervention notes |237238## Quality Rules239240- Prediction is not explanation unless interpreted carefully.241- Avoid leakage from future behavior or final outcomes.242- Split data at the student level when repeated events exist.243- Report class imbalance and baseline models.244- Prefer interpretable models for educational decision-making.245- Do not label students in stigmatizing ways; use supportive profile names.246- Preserve privacy for logs, prompts, writing samples, and account identifiers.247248## User-Facing Closure249250End by asking for the modeling objective:251252```text253学习行为数据可以进入建模阶段。你更想先做哪类分析:A. 学习者画像/聚类,B. 成绩或风险预测,C. 知识掌握追踪,D. AI 使用行为与写作改进关系?如果你不确定,我会根据数据字段推荐。254```