End-to-end learning analytics pipeline: engagement metrics, dropout prediction (GBM), and interactive Plotly dashboards — all from raw session data.
EdTech platforms generate terabytes of engagement data but lack the tools to act on it. This engine turns raw session logs into actionable insights: which students are at risk of churning, who's a power learner, and what drives retention.
| Feature | Description |
|---|---|
| 📈 Engagement Metrics | Sessions/week, consistency score, learning velocity |
| 🎯 Student Segmentation | Power Learner / Active / Casual / At-Risk / Churned clusters |
| 🤖 Dropout Predictor | Gradient Boosting model with 5-fold CV, ROC-AUC scoring |
| 🔄 Cohort Retention | Weekly retention heatmap (cohort analysis) |
| 📊 Interactive Dashboards | Plotly charts exportable as standalone HTML |
| 🧪 Synthetic Data Gen | Realistic 500-student dataset with configurable params |
git clone https://github.com/YOUR_USERNAME/learning-analytics-engine.git
cd learning-analytics-engine
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python run_analysis.py
# → Open outputs/index.html in your browserOutput after ~30 seconds:
🎓 Learning Analytics Engine
==================================================
[1/5] Generating data for 500 students...
✅ 500 students | 9,847 sessions | 3,221 assessments
[2/5] Computing engagement metrics...
power_learner : 89 (17.8%)
active_learner : 147 (29.4%)
casual_learner : 112 (22.4%)
at_risk : 91 (18.2%)
churned_early : 61 (12.2%)
[3/5] Computing learning velocity...
[4/5] Training dropout risk predictor...
CV ROC-AUC: 0.8912 ± 0.0143
Test ROC-AUC: 0.8876
Top predictors:
consistency_score : ████████████████ 0.3214
sessions_per_week : ████████████ 0.2891
total_sessions : ████████ 0.1823
[5/5] Generating interactive dashboards...
✅ 5 files saved to 'outputs/'
✅ Analysis complete in 28.4s
📂 Open outputs/index.html to view all reports
run_analysis.py # Orchestration pipeline
analytics/
├── data_generator.py # Synthetic EdTech data generation
├── engagement.py # Engagement metrics + student segmentation
├── dropout_predictor.py # GBM dropout risk model (sklearn Pipeline)
└── visualizer.py # Plotly interactive chart generation
outputs/
├── index.html # Dashboard index
├── engagement_overview.html # 4-panel engagement dashboard
├── dropout_risk.html # Risk scatter plot
├── learning_velocity.html # Velocity distribution
└── cohort_retention.html # Retention heatmap
Algorithm: Gradient Boosting Classifier (sklearn)
Evaluation: 5-fold stratified cross-validation
Target: Binary churn (inactive > 21 days OR < 3 sessions)
Top predictive features:
consistency_score— regularity of study habits (most predictive)sessions_per_week— frequency of engagementtotal_sessions— total usage historyavg_session_minutes— depth of engagement per sessionlessons_per_hour— learning efficiency
import pandas as pd
from analytics.engagement import compute_engagement_metrics, segment_students
from analytics.dropout_predictor import prepare_features, train_dropout_model, predict_dropout_risk
# Load your real data
students = pd.read_csv("your_students.csv")
sessions = pd.read_csv("your_sessions.csv")
assessments = pd.read_csv("your_assessments.csv")
# Run the pipeline
engagement = compute_engagement_metrics(students, sessions)
engagement = segment_students(engagement)
features = prepare_features(engagement, assessments)
labels = create_dropout_labels(engagement)
model_results = train_dropout_model(features, labels)
risk_df = predict_dropout_risk(model_results["model"], features)
print(risk_df[risk_df["risk_level"] == "high"]) # High-risk studentsMIT License