This project implements a system for predicting the number of virtual machines (VMs) to deploy based on the day of the week and the hour of the day.
It trains multiple regression models, evaluates their performance, and automatically selects the best model using a PROMETHEE-like multi‑criteria decision method.
- Loads dataset containing:
day ; hour ; nb_machine - Trains multiple regression models:
- Linear Regression
- Ridge Regression
- Lasso Regression
- Random Forest
- Support Vector Regressor (SVR)
- Gradient Boosting Regressor
- The AutoRegressive Integrated Moving Average (ARIMA)
- Prophet
- Long Short-Term Memory (LSTM) networks
- Transformer-based models
- Evaluates models using RMSE, MAE, R²
- Selects the best model through a PROMETHEE-like scoring method
- Saves the best model as
best_model.pkl - Generates predictions for 24 hours → out_prediction_one_day.csv
- Generates predictions for 7×24 hours →
out_prediction_one_week.csv - Generates predictions for 8×7×24 hours → out_prediction_two_months.csv
git clone https://github.com/CGI-FR/fogSLAAntillas.git
cd fogSLAAntillas
pip install -r requirements.txtRequires:
numpy==2.4.4,pandas==3.0.2,prophet==1.3.0,scikit_learn==1.8.0,statsmodels==0.14.6,tensorflow==2.21.0
| day | hour | nb_machine |
|---|---|---|
| 0 | 13 | 5 |
| 0 | 14 | 7 |
| ... | ... | ... |
Separator: ;
python CGI_Prediction_Model.py data.csvOutputs:
best_model.pklmodel_summary.csvout_prediction_one_day.csvout_prediction_one_week.csvout_prediction_two_months.csv
- Loads dataset from CSV
- Splits training/testing sets
- Trains all regression models
- Computes RMSE, MAE, R²
- Selects best model with PROMETHEE-like method
- Saves best model
- Generates one-week hourly predictions
import pickle
import CGI_Prediction_Model as cgi
with open("best_model.pkl", "rb") as f:
bundle = pickle.load(f)
model = bundle["model"]
prediction = cgi.predict_vms(0, 2, model)
print("Predicted VMs:", prediction[0])This code loads a previously trained machine learning model and uses it to predict the number of virtual machines (VMs) needed for a specific time.
- 2 corresponds to the 3rd day of the week (counting starts from 0).
- 15 corresponds to 15:00 (3 PM).
The function predict_vms() sends these values to the model, which returns the estimated number of VMs required at that time.
| day | hour | nb_machine |
|---|---|---|
| 0 | 0 | 4 |
| 0 | 1 | 4 |
| ... | ... | ... |
BSD-3 License