NOTQIN Research (4-Paper CBAM ML Series)
1. Project Summary
A research monorepo containing a 4-paper ML series on EU CBAM (Carbon Border Adjustment Mechanism) compliance for Moroccan textile manufacturers — covering energy disaggregation, Bayesian uncertainty quantification, carbon fraud detection, and causal attribution of emissions changes.
2. Research Question
How can Moroccan textile mills achieve CBAM compliance while reducing their carbon footprint, using IoT + ML to provide verifiable, audit-ready evidence?
3. Tech Stack
| Library | Purpose |
|---|---|
| PyTorch 2 + Lightning | Paper 1: iNILM-C neural models |
| NumPyro 0.13 + JAX | Paper 2: Bayesian posterior sampling |
| Tigramite 5.2 + DoWhy 0.11 | Paper 4: Causal DAG discovery |
| XGBoost 2 + HMMlearn | Paper 3: Manipulation detection |
| Optuna | Hyperparameter optimization |
| Weights & Biases | Experiment tracking |
| InfluxDB client | Live NOTQIN telemetry |
| Pandas, NumPy, SciPy, scikit-learn | Core numerics |
| Matplotlib, Seaborn, ArviZ | Visualizations + posterior diagnostics |
4. The 4 Papers
Paper 1 — iNILM-C: Non-Intrusive Load Monitoring for Carbon Attribution
Question: Can we disaggregate factory-level energy into per-product carbon footprints using only circuit-level sensors?
Approach:
- 4 NILM models: Seq2Point, Bi-LSTM, TCN, Transformer
- 3 supervision levels: full, semi-supervised (pseudo-labels), few-shot (active learning)
- Attribution: per-machine NILM → per-batch/product carbon intensity
4 Experiments:
- Model accuracy by supervision level (R² comparison)
- Per-product emissions accuracy (Energy Intensity Estimation)
- CBAM cost scenarios A–D (NDE → CCE → estimated cost)
- Active learning query strategy efficiency (BALD vs uncertainty sampling)
Dataset: HIPE benchmark + NOTQIN InfluxDB (if available)
Status: ✅ All 4 experiments runnable (python paper1_inilmc/run_all.py)
Paper 2 — BayesCBAM: Bayesian Uncertainty Quantification for Adaptive CBAM Audits
Question: Can Bayesian methods quantify uncertainty in carbon estimates and optimize where to allocate audit resources?
Approach:
- Hierarchical Bayesian regression (NumPyro / JAX HMC sampling)
- CUSUM bias detection + correction of systematic drift
- Cross-factory hierarchical priors (share statistical strength across plants)
6 Experiments:
- Posterior shrinkage over time (Bayesian learning rate)
- CUSUM bias detection + correction
- 5-year cost of 5 audit strategies comparison
- Adaptive vs fixed audit scheduling
- Cross-factory hierarchical prior benefit
- Full sensitivity analysis (priors, data noise, discount rates)
Status: ✅ All 6 experiments runnable (python paper2_bayescbam/run_all.py --exp N)
Paper 3 — CarbonGuard: Adversarial Carbon Reporting Detection
Question: Can ML detect manipulation of IoT sensor data used for CBAM reporting?
Manipulation types (M1–M12):
- M1: Sensor drift injection
- M2: Value clipping
- M3: Batch replay attacks
- M4: Timestamp jitter
- M5–M12: Additional adversarial patterns
Approach:
- Detection: XGBoost + HMM (multi-layer — sensor-level + batch-level + statistical)
- Game theory: Stackelberg game (attacker chooses manipulation strategy, auditor responds)
6 Experiments:
- Detection rate vs baselines (ROC/AUC)
- Per-manipulation-type detection rate
- Layer contribution ablation study
- Minimum detectable manipulation magnitude
- Stackelberg game equilibrium (Nash optimal strategies)
- False positive characterization under benign sensor noise
Status: ✅ All 6 experiments runnable (python paper3_carbonguard/run_all.py)
Paper 4 — CausalCBAM: Causal Attribution of Emissions Changes
Question: Which specific process changes (setpoint, batch size, ambient temp) causally reduce emissions?
Approach:
- PC-MCI+ (Tigramite) for causal DAG discovery
- DoWhy for causal effect estimation
- Target: infer causal graph (energy → temperature → pressure → emissions)
6 Experiments (scaffolded, mostly TBD): 1–6. Causal discovery + attribution experiments
Status: 🚧 Scaffold in place, experiments mostly TBD
5. Shared Infrastructure
shared/
├── utils/config.py → YAML config loading + env override
├── utils/reproducibility.py → Seed setting (NumPy, PyTorch, random)
├── utils/logging_setup.py → Structured logger
└── Dataset loaders + preprocessing
Results export:
results/tables/paper{1-4}/ → LaTeX .tex files (copy to paper)
results/figures/paper{1-4}/ → PDF plots (confusion matrices, ROC, posterior)
results/runs/ → Raw experiment JSON / wandb logs
Run any experiment:
uv pip install -e .
python paper1_inilmc/run_all.py # all 4 experiments
python paper2_bayescbam/run_all.py --exp 3 # just exp3 (5-year cost comparison)
python paper3_carbonguard/run_all.py6. Current Status
| Paper | Status | Completion |
|---|---|---|
| Paper 1 (iNILM-C) | ✅ Runnable | ~80% (validation on real NOTQIN data pending) |
| Paper 2 (BayesCBAM) | ✅ Runnable | ~75% (cross-factory transfer not fully tested) |
| Paper 3 (CarbonGuard) | ✅ Runnable | ~75% (real hardware validation TBD) |
| Paper 4 (CausalCBAM) | 🚧 Scaffold | ~25% (experiments mostly TBD) |
Last commit: Apr 14, 2026
Open items across all papers:
- Real NOTQIN telemetry validation (all experiments on synthetic/HIPE data now)
- Hyperparameter tuning (Optuna wired but not integrated per-paper)
- Cost model calibration with real factory input
- Causal discovery evaluation on real NOTQIN DAG
- Paper write-ups (LaTeX templates pending)
- Performance profiling (runtime, memory per experiment)
7. Strategic Value
This research positions the NOTQIN ecosystem as scientifically credible:
- Published papers → academic credibility for government/institutional partnerships
- CBAM ML tools → competitive advantage over manual compliance
- Fraud detection → regulatory appeal (EU auditors, ANRE, AMEE)
- UM6P / ENSIAS collaboration opportunity (co-authorship)
8. Next Actions
- Validate Paper 1 iNILM-C on real NOTQIN telemetry (connect InfluxDB)
- Complete Paper 4 CausalCBAM experiment implementations
- Calibrate cost models with real factory management input
- Submit Paper 1 to a workshop or conference (IEEE ISGT Africa?)
- Explore UM6P or ENSIAS co-authorship opportunity
- Create Jupyter notebooks for interactive results exploration