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-modeling3category: 开发工具4description: 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.5metadata:6 source: https://skillmd.com/skills/ilog3/education-learning-analytics-modeling7 short-description: Model learning logs, behavior data, knowledge tracing, clustering, and prediction8---910# Education Learning Analytics Modeling1112## Goal1314Turn education platform/log/behavior data into interpretable learning analytics models and paper-ready results.1516## Use After1718Use after:1920- `education-learning-analytics-design`21- `education-sampling-data-management`22- `education-quantitative-data-cleaning`23- `education-descriptive-statistics`24- `education-advanced-quantitative-modeling`2526Do not expose the skill name to users. Present it as "学习行为数据建模" or "学习分析建模".2728## Inputs2930- Cleaned log or learning behavior dataset31- Data dictionary32- Unit of analysis: student, session, event, item, assignment, time window33- Outcome: achievement, completion, engagement, dropout risk, mastery, writing improvement34- Time window and prediction target35- Privacy/anonymization constraints3637## Workflow38391. Define modeling objective:40 - descriptive behavior analysis41 - clustering/learner profiles42 - prediction/early warning43 - knowledge tracing/mastery estimation44 - sequence/pathway analysis45 - intervention/effect analysis462. Define unit and time window:47 - event-level48 - session-level49 - student-week50 - student-course51 - item/knowledge component523. Check data leakage:53 - features must occur before prediction target54 - no future outcome information in predictors55 - separate training/test by student or time where appropriate564. Engineer features:57 - frequency/count58 - duration/time-on-task59 - recency60 - regularity61 - completion62 - revision behavior63 - help-seeking64 - AI prompt/feedback usage65 - assessment history66 - knowledge component performance675. Choose model:68 - descriptive dashboards69 - k-means/hierarchical clustering/GMM/HDBSCAN70 - logistic/linear regression71 - random forest/gradient boosting72 - sequence models73 - Bayesian knowledge tracing/deep knowledge tracing when appropriate746. Split/evaluate:75 - train/test split76 - cross-validation77 - time-based validation78 - student-level split797. Evaluate metrics:80 - classification: accuracy, precision, recall, F1, AUC81 - regression: MAE, RMSE, R282 - clustering: silhouette, stability, interpretability83 - knowledge tracing: AUC, calibration, mastery curve848. Interpret model:85 - feature importance86 - SHAP/permutation importance87 - profile descriptions88 - educational meaning899. Produce figures/tables and result narrative.9091## Tool Calls9293### Python9495```bash96pip install pandas numpy scikit-learn statsmodels seaborn matplotlib shap xgboost lightgbm umap-learn hdbscan lifelines97```9899Feature aggregation:100101```python102features = (103 logs.groupby("student_id")104 .agg(105 n_sessions=("session_id", "nunique"),106 n_events=("event_id", "count"),107 total_time=("duration_sec", "sum"),108 avg_score=("score", "mean"),109 n_ai_feedback=("ai_feedback_used", "sum")110 )111 .reset_index()112)113```114115Prediction:116117```python118from sklearn.model_selection import train_test_split, cross_val_score119from sklearn.ensemble import RandomForestClassifier120from sklearn.metrics import classification_report, roc_auc_score121122X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.2, stratify=y, random_state=42)123model = RandomForestClassifier(random_state=42)124model.fit(X_train, y_train)125pred = model.predict(X_test)126proba = model.predict_proba(X_test)[:, 1]127print(classification_report(y_test, pred))128print(roc_auc_score(y_test, proba))129```130131Clustering:132133```python134from sklearn.preprocessing import StandardScaler135from sklearn.cluster import KMeans136from sklearn.metrics import silhouette_score137138X_scaled = StandardScaler().fit_transform(X)139km = KMeans(n_clusters=3, random_state=42).fit(X_scaled)140silhouette_score(X_scaled, km.labels_)141```142143SHAP:144145```python146import shap147explainer = shap.TreeExplainer(model)148shap_values = explainer.shap_values(X_test)149```150151### R152153```r154install.packages(c("tidyverse", "tidymodels", "caret", "cluster", "factoextra", "TraMineR", "lme4"))155```156157Feature aggregation:158159```r160features <- logs |>161 group_by(student_id) |>162 summarise(163 n_sessions = n_distinct(session_id),164 n_events = n(),165 total_time = sum(duration_sec, na.rm = TRUE),166 avg_score = mean(score, na.rm = TRUE),167 n_ai_feedback = sum(ai_feedback_used, na.rm = TRUE)168 )169```170171Sequence analysis:172173```r174install.packages("TraMineR")175library(TraMineR)176```177178### Knowledge Tracing Tools179180```text181pyBKT: https://github.com/CAHLR/pyBKT182pyKT: https://github.com/pykt-team/pykt-toolkit183EduKTM: https://github.com/bigdata-ustc/EduKTM184```185186Install examples:187188```bash189pip install pyBKT190```191192Use knowledge tracing only when data include repeated item/skill/knowledge-component interactions.193194## Output Format195196### 1. Modeling Objective197198| Objective | Outcome | Unit | Time Window | Model Family |199|---|---|---|---|---|200201### 2. Feature Table202203| Feature | Definition | Time Window | Source | Leakage Risk | Educational Meaning |204|---|---|---|---|---|---|205206### 3. Model Plan207208| Model | Purpose | Inputs | Evaluation Metric | Interpretation Method |209|---|---|---|---|---|210211### 4. Results Table212213| Model | Metric | Value | Baseline Comparison | Interpretation |214|---|---|---|---|---|215216### 5. Learner Profile Table217218| Cluster/Profile | Behavioral Pattern | Size | Outcome Pattern | Teaching Implication |219|---|---|---|---|---|220221### 6. Knowledge Tracing Table222223| Knowledge Component | Initial Mastery | Learning Rate | Guess/Slip | Interpretation |224|---|---|---|---|---|225226### 7. Reporting Template227228```text229基于学习平台日志,本研究构建了 [特征数量] 个学习行为特征,涵盖学习频率、学习持续时间、任务完成、AI 反馈使用和测验表现等维度。模型以 [结果变量] 为预测目标,采用 [模型] 进行分析。结果显示,模型在测试集上的 [指标] 为 [数值],其中 [重要特征] 对预测贡献较大。该结果表明 [教育解释]。230```231232## Education-Specific Feature Ideas233234| Context | Features |235|---|---|236| AI writing platform | prompt count, feedback accepted, revision count, draft length change, time between drafts |237| LMS course | login frequency, video completion, quiz attempts, assignment lateness, forum posts |238| Intelligent tutoring | item attempts, hints requested, skill mastery, response time, error patterns |239| Reading platform | reading duration, pages completed, annotation count, comprehension score |240| Teacher dashboard | feedback frequency, grading turnaround, intervention notes |241242## Quality Rules243244- Prediction is not explanation unless interpreted carefully.245- Avoid leakage from future behavior or final outcomes.246- Split data at the student level when repeated events exist.247- Report class imbalance and baseline models.248- Prefer interpretable models for educational decision-making.249- Do not label students in stigmatizing ways; use supportive profile names.250- Preserve privacy for logs, prompts, writing samples, and account identifiers.251252## User-Facing Closure253254End by asking for the modeling objective:255256```text257学习行为数据可以进入建模阶段。你更想先做哪类分析:A. 学习者画像/聚类,B. 成绩或风险预测,C. 知识掌握追踪,D. AI 使用行为与写作改进关系?如果你不确定,我会根据数据字段推荐。258```