Two machine learning scripts exploring different levels of model complexity — from a minimal regression baseline to a neural network with model monitoring.
main-sklearn.py— Linear regression with scikit-learn on synthetic datamain-2.py— MLP classifier with PyTorch on the Titanic dataset, including Evidently AI monitoring and Prometheus metrics
The Titanic dataset is loaded automatically from a public URL. No local file needed.
Features used: Pclass, Sex, Age, SibSp, Parch, Fare, Embarked
Target: Survived (0 = No, 1 = Yes)
A 3-layer MLP built with PyTorch:
- Loss: CrossEntropyLoss
- Optimizer: SGD (lr=0.01)
- Epochs: 1000
- Split: 80% train / 20% test
After training, the script generates:
model_monitoring_report.html— Evidently AI report (Data Drift, Target Drift, Classification metrics)- Prometheus metrics exposed at
http://localhost:8000
pip install torch pandas scikit-learn evidently prometheus-client
# Minimal linear regression
python main-sklearn.py
# Titanic MLP + monitoring
python main-2.pyPython · PyTorch · scikit-learn · pandas · Evidently AI · Prometheus