All components have been successfully created. Here's what has been implemented:
c5i.a-Mlops-test/
├── data/
│ └── gas_sensors_full_scale_dataset.csv
├── src/
│ ├── preprocessing/ (7 modules)
│ ├── analytics/ (2 modules)
│ ├── features/ (1 module)
│ ├── validation/ (1 module)
│ ├── models/ (2 modules)
│ ├── anomaly/ (1 module)
│ └── deployment/ (2 modules)
├── notebooks/
│ └── exploration.ipynb
├── main.py
├── requirements.txt
└── README.md
- BasePreprocessor (abstract class)
- MissingHandler (interpolation, forward fill)
- OutlierHandler (IQR, Z-score)
- Normalizer (tank-level scaling)
- Resampler (uniform intervals)
- Aligner (golden profile alignment)
- PreprocessingPipeline (end-to-end)
- Batch metrics (peak CO2, time-to-peak, DO half-life, pressure growth)
- Rolling statistics (mean, std, kurtosis, CV)
- Pivot tables for batch comparison
- Attenuation slope computation
- Cosine similarity (live vs golden curves)
- Euclidean distance matrix (broadcasting)
- Pearson correlation matrix
- Tank distance computation
- Polynomial features
- Interaction terms (CO2 × temperature)
- Lag features (5, 15, 60 minutes)
- Rolling statistical features
- Temporal features (hour, day, cyclical encoding)
- Phase binning
- Schema validation
- Range validation
- Duplicate timestamp detection
- Missing value detection
- Outlier detection rules
- Validation report generation
- PhasePredictor (GBM for phase classification)
- ChangepointDetector (phase boundary detection)
- Model save/load functionality
- Macro-F1 evaluation
- Stuck fermentation detection
- Oxidation risk detection
- Pressure anomaly detection
- Abnormal CO2 activity detection
- Anomaly timeline generation
- FastAPI (predict, detect_anomalies, batch_summary endpoints)
- Automated batch report generation (JSON & HTML)
- Data-driven recommendations
-
Install dependencies:
pip install -r requirements.txt
-
Run the complete pipeline:
python main.py
-
Start the API server:
from src.deployment import create_app from src.models import PhasePredictor from src.anomaly import AnomalyDetector import uvicorn predictor = PhasePredictor() predictor.load('models/phase_predictor.pkl') detector = AnomalyDetector() app = create_app(predictor, detector) uvicorn.run(app, host="0.0.0.0", port=8000)
After running main.py, you'll get:
- models/phase_predictor.pkl - Trained model
- reports/batch_*_report.json - Batch reports
- Console output with processing status
- The dataset has been adapted to work with the gas sensor data structure
- Synthetic batch_id, strain, and style columns are created if not present
- All modules are fully functional and tested
- The system is production-ready with proper error handling
- Run python main.py to process your data
- Explore notebooks/exploration.ipynb for detailed examples
- Customize thresholds and parameters in each module as needed
- Deploy the API for real-time predictions
Status: COMPLETE - All requirements implemented!