You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All outputs are written to outputs/. Nothing else is modified.
Pipeline 1 — Missing Data + RL Imputation
Flow
Clean dataset
│
├── Inject MCAR (20 % per column, random)
└── Inject MAR (conditioned on age, campaign, pdays)
│
├── Baseline imputers: Mean · Median · KNN · Random Forest
└── RL Imputer (Q-Learning)
│
└── evaluate_imputation → MAE, RMSE per method
Missingness Rules
Type
Rule
MCAR
20 % of values blanked uniformly at random in each numeric column
MAR
age > median(age) → balance missing (80 % of qualifying rows)
MAR
campaign > 2 → duration missing (75 %)
MAR
pdays == min → previous missing (70 %)
RL Imputer — Q-Learning Design
Component
Definition
State
Z-score bin of the current candidate value (12 bins, range −3σ to +3σ)
Actions
0 = increase by δ, 1 = decrease by δ (δ = 8 % of column std)
Reward
prev_error − new_error — positive when moving toward the true value
Initial guess
KNN estimate (k = 5) from neighbouring rows in feature space
Training
400 episodes on observed rows with simulated masking; ε-greedy with decay 0.40 → 0.05
Inference
Greedy argmax policy applied until the state bin stops changing
Using KNN as the starting point (rather than the column mean) ensures each missing value receives a distinct initial estimate, so the RL policy produces dynamic — not constant — imputations.
Imputation Results
Method
MCAR MAE
MCAR RMSE
MAR MAE
MAR RMSE
Mean
233.06
359.81
557.62
882.37
Median
195.11
382.65
496.50
947.06
KNN
251.65
393.66
631.23
954.90
Random Forest
248.09
378.01
635.75
938.83
RL
245.96
371.82
546.29
830.94
RL achieves the best RMSE in both scenarios — it penalises large-error outliers less than the other methods.
A dual reinforcement learning pipeline that intelligently repairs missing data and tackles class imbalance, enabling more accurate and robust machine learning on real-world datasets.