|
5 | 5 | "id": "326b3005-9a8e-4b07-9d4c-bb2e2ae5ffd9", |
6 | 6 | "metadata": {}, |
7 | 7 | "source": [ |
8 | | - "# Churn Model Training + Deployment Pipeline\n", |
| 8 | + "# Churn Model: training and deployment pipeline\n", |
9 | 9 | "\n", |
10 | | - "The first part of this demo is to train a tabular ML model for predicting churn. This will be used later in our application pipeline to provide context to the LLM to customize the response.\n", |
| 10 | + "The first part of this demo is to train a tabular ML model for predicting churn. This will be used later in the application pipeline to provide context to the LLM to customize the response.\n", |
11 | 11 | "\n", |
12 | | - "This training pipeline is a standard ML training and deployment pipeline. The only \"unusual\" step is an additional pre-processing step that generates a sentiment analysis score using historical conversational data from a chat log. This sentiment score is used as a model input - we will see later that it is actually the most important feature when predicting churn.\n", |
13 | | - "\n", |
14 | | - "In addition to model training, this notebook demonstrates how to log datasets, run ML pipelines remotely, deploy models as serving functions, and enable model monitoring for production use. The workflow is fully automated using MLRun, making it easy to track experiments, manage artifacts, and monitor deployed models in real time.\n", |
15 | | - "\n", |
16 | | - "# Churn Model Training + Deployment Pipeline\n", |
17 | | - "\n", |
18 | | - "The first part of this demo is to train a tabular ML model for predicting churn. This will be used later in our application pipeline to provide context to the LLM to customize the response.\n", |
19 | | - "\n", |
20 | | - "This training pipeline is a standard ML training and deployment pipeline. The only \"unusual\" step is an additional pre-processing step that generates a sentiment analysis score using historical conversational data from a chat log. This sentiment score is used as a model input - we will see later that it is actually the most important feature when predicting churn.\n", |
| 12 | + "This training pipeline is a standard ML training and deployment pipeline. The only \"unusual\" step is an additional pre-processing step that generates a sentiment analysis score using historical conversational data from a chat log. This sentiment score is used as a model input - you'll see later that it is actually the most important feature when predicting churn.\n", |
21 | 13 | "\n", |
22 | 14 | "In addition to model training, this notebook demonstrates how to log datasets, run ML pipelines remotely, deploy models as serving functions, and enable model monitoring for production use. The workflow is fully automated using MLRun, making it easy to track experiments, manage artifacts, and monitor deployed models in real time.\n", |
23 | 15 | "\n", |
24 | 16 | "" |
25 | 17 | ] |
26 | 18 | }, |
| 19 | + { |
| 20 | + "cell_type": "markdown", |
| 21 | + "id": "6fdd7bba", |
| 22 | + "metadata": {}, |
| 23 | + "source": [ |
| 24 | + "## Table of contents\n", |
| 25 | + " 1. [Install MLRun](#install-mlrun)\n", |
| 26 | + " 2. [Set up the project](#set-up-the-project)\n", |
| 27 | + " 2. [Log the dataset](#log-the-dataset)\n", |
| 28 | + " 2. [Run the pipeline](#run-the-pipeline)\n", |
| 29 | + " 2. [View the output training artifacts](#view-the-output-training-artifacts)\n", |
| 30 | + " 2. [Test the model endpoint](#test-the-model-endpoint)\n", |
| 31 | + " 2. [Model monitoring](#model-monitoring)\n", |
| 32 | + " \n", |
| 33 | + " (install-mlrun)=\n", |
| 34 | + " ## Install MLRun and set up the environment\n", |
| 35 | + "\n", |
| 36 | + " First import mlrun and other required packages:" |
| 37 | + ] |
| 38 | + }, |
27 | 39 | { |
28 | 40 | "cell_type": "code", |
29 | 41 | "execution_count": null, |
|
51 | 63 | "id": "3a1ca344-b7fd-47a7-86b7-575d352851a4", |
52 | 64 | "metadata": {}, |
53 | 65 | "source": [ |
54 | | - "### Setup Project\n", |
| 66 | + "### Set the up project\n", |
55 | 67 | "\n", |
56 | | - "First, create and populate the MLRun project. Under the hood, this will execute [project_setup.py](project_setup.py) to add our MLRun functions, workflows, and build the project image - see the [documentation](https://docs.mlrun.org/en/stable/projects/project-setup.html) for more information.\n", |
| 68 | + "Now, create and populate the MLRun project. Under the hood, this executes [project_setup.py](project_setup.py) to add our MLRun functions, workflows, and build the project image. See the [documentation](https://docs.mlrun.org/en/stable/projects/project-setup.html) for more information.\n", |
57 | 69 | "\n", |
58 | 70 | "Make sure to enable `force_build` on the first run to build the project image. After the initial setup, you can disable `force_build` to speed up subsequent runs. This setup ensures all dependencies and source code are packaged for reproducible and scalable ML workflows.\n", |
59 | 71 | "\n", |
60 | | - "Set the OpenAI credentials in the project and local environment - **be sure to update [.env.example](.env.example) as described in the [README](README.md)**." |
| 72 | + "Set the OpenAI credentials in the project and local environment - **be sure to update [.env.example](.env.example) as described in the [README](README.md#prerequisites)**." |
61 | 73 | ] |
62 | 74 | }, |
63 | 75 | { |
|
103 | 115 | "id": "43af04dc", |
104 | 116 | "metadata": {}, |
105 | 117 | "source": [ |
106 | | - "*Please note that you will need to set the `\"build_image\": True` once to build the default image for the project. After you successfully built the image, set the `\"build_image\": False\"` to continue.*" |
| 118 | + "**Set the `\\\"build_image\\\": True` once to build the default image for the project. After you successfully built the image, set the `\\\"build_image\\\": False\\\"` to continue.**" |
107 | 119 | ] |
108 | 120 | }, |
109 | 121 | { |
|
133 | 145 | "id": "6c1e6f8a-b144-4311-bdf4-7a5fee3e6bd9", |
134 | 146 | "metadata": {}, |
135 | 147 | "source": [ |
136 | | - "Enables project model monitoring and deploys required infrastructure - see [documentation](https://docs.mlrun.org/en/stable/tutorials/05-model-monitoring.html#realtime-monitor-drift-tutor) for more information. Only needs to be run once." |
| 148 | + "Enable project model monitoring on the project and deploy required infrastructure. See [documentation](https://docs.mlrun.org/en/stable/tutorials/05-model-monitoring.html#realtime-monitor-drift-tutor) for more information. This only needs to be run once." |
137 | 149 | ] |
138 | 150 | }, |
139 | 151 | { |
|
154 | 166 | "id": "7e50bd0d-096f-4322-b509-31b3ac358782", |
155 | 167 | "metadata": {}, |
156 | 168 | "source": [ |
157 | | - "### Log Dataset" |
| 169 | + "### Log the dataset" |
158 | 170 | ] |
159 | 171 | }, |
160 | 172 | { |
|
186 | 198 | "id": "a813c814-e7e1-45b8-b991-72579efe8eda", |
187 | 199 | "metadata": {}, |
188 | 200 | "source": [ |
189 | | - "### Run Pipeline" |
| 201 | + "### Run the pipeline" |
190 | 202 | ] |
191 | 203 | }, |
192 | 204 | { |
193 | 205 | "cell_type": "markdown", |
194 | 206 | "id": "cab7d535-244d-4f21-9e1e-61310afed118", |
195 | 207 | "metadata": {}, |
196 | 208 | "source": [ |
197 | | - "Submits [train_and_deploy_workflow.py](src/workflows/train_and_deploy_workflow.py) via Kubeflow Pipelines. ***Note**: Requires minimum 6 CPU to run (see `sentiment_fn` step).*" |
| 209 | + "This step submits the [train_and_deploy_workflow.py](src/workflows/train_and_deploy_workflow.py) via Kubeflow Pipelines. \n", |
| 210 | + "\n", |
| 211 | + "This requires a minimum of 6 CPUs to run (see `sentiment_fn` step in train_and_deploy_workflow.py)." |
198 | 212 | ] |
199 | 213 | }, |
200 | 214 | { |
|
517 | 531 | "id": "8e4207f4-4fe7-474d-b5d0-761da5a3226e", |
518 | 532 | "metadata": {}, |
519 | 533 | "source": [ |
520 | | - "### View Output Training Artifacts\n", |
| 534 | + "### View the output training artifacts\n", |
521 | 535 | "\n", |
522 | 536 | "View the training artifacts in the MLRun UI like so:\n", |
523 | 537 | "\n", |
524 | 538 | "\n", |
525 | 539 | "\n", |
526 | | - "Or pull the artifacts directly into your notebook for additional exploration like below - see nore information about using data & artifacts in the [documentation](https://docs.mlrun.org/en/stable/concepts/data.html)." |
| 540 | + "Alternatively, you can pull the artifacts directly into your notebook for additional exploration like below. See more information about using data and artifacts in the [documentation](https://docs.mlrun.org/en/stable/concepts/data.html)." |
527 | 541 | ] |
528 | 542 | }, |
529 | 543 | { |
|
926 | 940 | "id": "0dfeee46-4f82-4277-aad1-3cc5583ca8f3", |
927 | 941 | "metadata": {}, |
928 | 942 | "source": [ |
929 | | - "### Test Model Endpoint" |
| 943 | + "### Test the model endpoint" |
930 | 944 | ] |
931 | 945 | }, |
932 | 946 | { |
933 | 947 | "cell_type": "markdown", |
934 | 948 | "id": "9c4d263a-297a-4d2d-b8f4-03e5790e0789", |
935 | 949 | "metadata": {}, |
936 | 950 | "source": [ |
937 | | - "Test newly deployed real-time endpoint using test data." |
| 951 | + "Test the newly deployed real-time endpoint using test data." |
938 | 952 | ] |
939 | 953 | }, |
940 | 954 | { |
|
998 | 1012 | "id": "e536babe-e987-4b33-a93c-243fd8abeb43", |
999 | 1013 | "metadata": {}, |
1000 | 1014 | "source": [ |
1001 | | - "### Model Monitoring\n", |
| 1015 | + "### Model monitoring\n", |
1002 | 1016 | "\n", |
1003 | | - "Once the churn model is deployed and invoked, you will be able to view the model monitoring results in the MLRun UI:\n", |
| 1017 | + "Once the churn model is deployed and invoked, you can view the model monitoring results in the MLRun UI:</br>\n", |
1004 | 1018 | "" |
1005 | 1019 | ] |
1006 | 1020 | } |
|
0 commit comments