Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added data/X_test.pkl
Binary file not shown.
Binary file added data/X_train.pkl
Binary file not shown.
3,630 changes: 3,630 additions & 0 deletions data/processed_test.csv

Large diffs are not rendered by default.

9,613 changes: 9,613 additions & 0 deletions data/processed_train.csv

Large diffs are not rendered by default.

Binary file added data/y_test.pkl
Binary file not shown.
Binary file added data/y_train.pkl
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
artifact_uri: file:///c:/Users/PC/Desktop/sprint5/Churn-Prediction-avec-MLflow/mlruns/667014208243130233/9ef1f5bd1b494066bbf7d0c26b56384f/artifacts
end_time: 1761903195677
entry_point_name: ''
experiment_id: '667014208243130233'
lifecycle_stage: active
run_id: 9ef1f5bd1b494066bbf7d0c26b56384f
run_name: flawless-asp-958
source_name: ''
source_type: 4
source_version: ''
start_time: 1761903188164
status: 3
tags: []
user_id: PC
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1761903188256 0.5 0
1761903188256 0.5 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
1761903188251 0.5 0
1761903188251 0.5 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
destination_id: m-4cd66135667c4e2cb0101afb74becdba
destination_type: MODEL_OUTPUT
source_id: m-4cd66135667c4e2cb0101afb74becdba
source_type: RUN_OUTPUT
step: 0
tags: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
demo run created by notebook
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
none
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flawless-asp-958
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7d7b02a1d9989bc64551a48a0fdd7dd157da51d2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c:\Users\PC\Desktop\sprint5\Churn-Prediction-avec-MLflow\venv\Lib\site-packages\ipykernel_launcher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LOCAL
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PC
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DummyModel
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
artifact_path: file:///c:/Users/PC/Desktop/sprint5/Churn-Prediction-avec-MLflow/mlruns/667014208243130233/models/m-4cd66135667c4e2cb0101afb74becdba/artifacts
flavors:
python_function:
env:
conda: conda.yaml
virtualenv: python_env.yaml
loader_module: mlflow.sklearn
model_path: model.pkl
predict_fn: predict
python_version: 3.12.2
sklearn:
code: null
pickled_model: model.pkl
serialization_format: cloudpickle
sklearn_version: 1.7.2
mlflow_version: 3.5.1
model_id: m-4cd66135667c4e2cb0101afb74becdba
model_size_bytes: 477
model_uuid: m-4cd66135667c4e2cb0101afb74becdba
prompts: null
run_id: 9ef1f5bd1b494066bbf7d0c26b56384f
utc_time_created: '2025-10-31 09:33:08.356111'
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
channels:
- conda-forge
dependencies:
- python=3.12.2
- pip<=24.0
- pip:
- mlflow==3.5.1
- cloudpickle==3.1.1
- numpy==2.3.4
- pandas==2.3.3
- psutil==7.1.1
- pyarrow==21.0.0
- scikit-learn==1.7.2
- scipy==1.16.2
name: mlflow-env
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
python: 3.12.2
build_dependencies:
- pip==24.0
- setuptools
- wheel
dependencies:
- -r requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
mlflow==3.5.1
cloudpickle==3.1.1
numpy==2.3.4
pandas==2.3.3
psutil==7.1.1
pyarrow==21.0.0
scikit-learn==1.7.2
scipy==1.16.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
artifact_location: file:///c:/Users/PC/Desktop/sprint5/Churn-Prediction-avec-MLflow/mlruns/667014208243130233/models/m-4cd66135667c4e2cb0101afb74becdba/artifacts
creation_timestamp: 1761903188309
experiment_id: '667014208243130233'
last_updated_timestamp: 1761903195660
model_id: m-4cd66135667c4e2cb0101afb74becdba
model_type: null
name: model
source_run_id: 9ef1f5bd1b494066bbf7d0c26b56384f
status: 2
status_message: null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1761903188256 0.5 0 9ef1f5bd1b494066bbf7d0c26b56384f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1761903188251 0.5 0 9ef1f5bd1b494066bbf7d0c26b56384f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
demo run created by notebook
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7d7b02a1d9989bc64551a48a0fdd7dd157da51d2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c:\Users\PC\Desktop\sprint5\Churn-Prediction-avec-MLflow\venv\Lib\site-packages\ipykernel_launcher.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LOCAL
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PC
101 changes: 64 additions & 37 deletions notebooks/3_training_mlflow.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
},
{
"cell_type": "code",
"execution_count": 108,
"execution_count": 171,
"id": "661c451b",
"metadata": {},
"outputs": [
Expand All @@ -359,13 +359,29 @@
"name": "index",
"rawType": "int64",
"type": "integer"
},
{
"name": "metrics.accuracy",
"rawType": "float64",
"type": "float"
},
{
"name": "metrics.f1",
"rawType": "float64",
"type": "float"
}
],
"ref": "ed29b0ae-02af-44b5-8e8b-3a1d02787b41",
"rows": [],
"ref": "723820ad-eff1-43d0-8403-e4115ac8b38a",
"rows": [
[
"0",
"0.5",
"0.5"
]
],
"shape": {
"columns": 0,
"rows": 0
"columns": 2,
"rows": 1
}
},
"text/html": [
Expand All @@ -387,20 +403,26 @@
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>metrics.accuracy</th>\n",
" <th>metrics.f1</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0.5</td>\n",
" <td>0.5</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
"Empty DataFrame\n",
"Columns: []\n",
"Index: []"
" metrics.accuracy metrics.f1\n",
"0 0.5 0.5"
]
},
"execution_count": 108,
"execution_count": 171,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -411,22 +433,22 @@
},
{
"cell_type": "code",
"execution_count": 48,
"execution_count": 172,
"id": "eaa49d1c",
"metadata": {},
"outputs": [
{
"ename": "KeyError",
"evalue": "'metrics.f1'",
"output_type": "error",
"traceback": [
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
"\u001b[31mKeyError\u001b[39m Traceback (most recent call last)",
"\u001b[32m~\\AppData\\Local\\Temp\\ipykernel_15856\\758707258.py\u001b[39m in \u001b[36m?\u001b[39m\u001b[34m()\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m best_run = runs.sort_values(\u001b[33m\"metrics.f1\"\u001b[39m, ascending=\u001b[38;5;28;01mFalse\u001b[39;00m).iloc[\u001b[32m0\u001b[39m]\n\u001b[32m 2\u001b[39m md(f\"**Meilleur modèle :** {best_run[\u001b[33m'tags.model_name'\u001b[39m]} (F1 = {best_run[\u001b[33m'metrics.f1'\u001b[39m]:.3f})\")\n",
"\u001b[32mc:\\Users\\PC\\Desktop\\sprint5\\Churn-Prediction-avec-MLflow\\venv\\Lib\\site-packages\\pandas\\core\\frame.py\u001b[39m in \u001b[36m?\u001b[39m\u001b[34m(self, by, axis, ascending, inplace, kind, na_position, ignore_index, key)\u001b[39m\n\u001b[32m 7207\u001b[39m )\n\u001b[32m 7208\u001b[39m \u001b[38;5;28;01melif\u001b[39;00m len(by):\n\u001b[32m 7209\u001b[39m \u001b[38;5;66;03m# len(by) == 1\u001b[39;00m\n\u001b[32m 7210\u001b[39m \n\u001b[32m-> \u001b[39m\u001b[32m7211\u001b[39m k = self._get_label_or_level_values(by[\u001b[32m0\u001b[39m], axis=axis)\n\u001b[32m 7212\u001b[39m \n\u001b[32m 7213\u001b[39m \u001b[38;5;66;03m# need to rewrap column in Series to apply key function\u001b[39;00m\n\u001b[32m 7214\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m key \u001b[38;5;28;01mis\u001b[39;00m \u001b[38;5;28;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n",
"\u001b[32mc:\\Users\\PC\\Desktop\\sprint5\\Churn-Prediction-avec-MLflow\\venv\\Lib\\site-packages\\pandas\\core\\generic.py\u001b[39m in \u001b[36m?\u001b[39m\u001b[34m(self, key, axis)\u001b[39m\n\u001b[32m 1910\u001b[39m values = self.xs(key, axis=other_axes[\u001b[32m0\u001b[39m])._values\n\u001b[32m 1911\u001b[39m \u001b[38;5;28;01melif\u001b[39;00m self._is_level_reference(key, axis=axis):\n\u001b[32m 1912\u001b[39m values = self.axes[axis].get_level_values(key)._values\n\u001b[32m 1913\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m-> \u001b[39m\u001b[32m1914\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m KeyError(key)\n\u001b[32m 1915\u001b[39m \n\u001b[32m 1916\u001b[39m \u001b[38;5;66;03m# Check for duplicates\u001b[39;00m\n\u001b[32m 1917\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m values.ndim > \u001b[32m1\u001b[39m:\n",
"\u001b[31mKeyError\u001b[39m: 'metrics.f1'"
]
"data": {
"text/markdown": [
"**Meilleur modèle :** DummyModel (F1 = 0.500)"
],
"text/plain": [
"<IPython.core.display.Markdown object>"
]
},
"execution_count": 172,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
Expand All @@ -444,22 +466,10 @@
},
{
"cell_type": "code",
"execution_count": 66,
"execution_count": 173,
"id": "3f546c09",
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'best_run' is not defined",
"output_type": "error",
"traceback": [
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
"\u001b[31mNameError\u001b[39m Traceback (most recent call last)",
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[66]\u001b[39m\u001b[32m, line 2\u001b[39m\n\u001b[32m 1\u001b[39m \u001b[38;5;66;03m# Chargement et test du modèle\u001b[39;00m\n\u001b[32m----> \u001b[39m\u001b[32m2\u001b[39m model_uri = \u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mruns:/\u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[43mbest_run\u001b[49m[\u001b[33m'\u001b[39m\u001b[33mrun_id\u001b[39m\u001b[33m'\u001b[39m]\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m/model\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 3\u001b[39m loaded_model = mlflow.sklearn.load_model(model_uri)\n",
"\u001b[31mNameError\u001b[39m: name 'best_run' is not defined"
]
}
],
"outputs": [],
"source": [
"# Chargement et test du modèle\n",
"model_uri = f\"runs:/{best_run['run_id']}/model\"\n",
Expand All @@ -468,7 +478,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 174,
"id": "638439a2",
"metadata": {},
"outputs": [],
Expand All @@ -491,13 +501,30 @@
"execution_count": null,
"id": "a5fa9d0a",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"✅ Prédiction exemple :\n",
"[0 0 0 0 0]\n"
]
}
],
"source": [
"# Exemple d’un batch de test\n",
"X_test = joblib.load(\"data/X_test.pkl\")\n",
"print(\"✅ Prédiction exemple :\")\n",
"print(loaded_model.predict(X_test[:5]))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0983ddc2",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
6 changes: 6 additions & 0 deletions notebooks/mlruns/0/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
artifact_location: file:///c:/Users/PC/Desktop/sprint5/Churn-Prediction-avec-MLflow/notebooks/mlruns/0
creation_time: 1761902129601
experiment_id: '0'
last_update_time: 1761902129601
lifecycle_stage: active
name: Default
6 changes: 6 additions & 0 deletions notebooks/mlruns/444479824665946921/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
artifact_location: file:///c:/Users/PC/Desktop/sprint5/Churn-Prediction-avec-MLflow/notebooks/mlruns/444479824665946921
creation_time: 1761902200854
experiment_id: '444479824665946921'
last_update_time: 1761902200854
lifecycle_stage: active
name: Churn_Prediction_Models
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading