diff --git a/Dockerfile b/Dockerfile index ca648cf4786e03fc8d97afa895100220e05719da..448067fb4ea9c6da0ac7cba6f23b799598cfd10c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ FROM python:3.10 -ADD /app/ . - +ADD requirements.txt . RUN pip install -r requirements.txt +ADD /app/ . + CMD ["python", "main.py"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..2a7206bd874ad7a2b9afedbe2174a9b6bb371aa1 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# Exercice de Deployement d'application ML sur edge dans l'environement Azure + +## Description de l'application + +Un model de machine learning XGBoost à été entrainé avec les données d'un capteur de puissance electrique consommé. + +Caracteristiques du dataset d'entrainement : + +- 2 semaines de mesures +- interval de 1min entre chaque valeur de puissance +- puissance actives pour chacune des 3 phases + +Ce model est enregistré dans le fichier "model_xgboost.json" + +Le programme principale utilise un dataset de test d'une durée de 1 jour, et effectue une prediction pour chaque mesure. + +### Test du programme + +```console +docker build -t app_ml_edge . +docker run -it app_ml_edge +``` diff --git a/app/main.py b/app/main.py index a0c9aa2123d12feef3550c9385bcbed9203bfb9c..1a3cd948748fb9174348a959ad482cb27bd32843 100644 --- a/app/main.py +++ b/app/main.py @@ -39,7 +39,7 @@ def predict(df, reg = None): reg.load_model("model_xgboost.json") df, x, y = prepare_feat(df) - + print(f'\nTimestamp, [prediction], real value, {bcolors.OKGREEN}percentage error{bcolors.ENDC}\n') for i in range(len(x)): tmp = x.iloc[i].to_frame().T predictions = reg.predict(tmp) @@ -62,5 +62,5 @@ if __name__ == "__main__": df = pd.read_csv('159_2023-01-11_1d.csv') df['timestamp'] = pd.to_datetime(df['timestamp']) df = df.set_index('timestamp') - print('predict') + predict(df) diff --git a/app/requirements.txt b/requirements.txt similarity index 54% rename from app/requirements.txt rename to requirements.txt index 346fd39bd780ce52545dec6955a159db50c1bb48..9c9d05c5281c35c84f9efb55471818884474dbf6 100644 --- a/app/requirements.txt +++ b/requirements.txt @@ -1,9 +1,6 @@ pandas -matplotlib xgboost scikit-learn -exoscale importlib-metadata bson -#matplotlib gui : -pyqt5 +