You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/machine-learning/preview/scenario-predictive-maintenance.md
+37-16Lines changed: 37 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,8 @@
2
2
title: 'Predictive Maintenance Real World Scenario| Microsoft Docs'
3
3
description: Predictive Maintenance Real World Scenario using PySpark
4
4
services: machine-learning
5
-
author: jaymathe
6
-
ms.author: jaymathe
5
+
author: ehrlinger
6
+
ms.author: jehrling
7
7
manager: jhubbard
8
8
ms.reviewer: garyericson, jasonwhowell, mldocs
9
9
ms.service: machine-learning
@@ -15,7 +15,6 @@ ms.date: 09/25/2017
15
15
16
16
# Predictive Maintenance Real World Scenario
17
17
18
-
19
18
The impact of unscheduled equipment downtime can be detrimental for any business. It is critical to therefore keep field equipment running in order to maximize utilization and performance and by minimizing costly, unscheduled downtime. Early identification of issues can help allocate limited maintenance resources in a cost-effective way and enhance quality and supply chain processes.
20
19
21
20
For this scenario, we use a relatively [large-scale data](https://github.com/Microsoft/SQL-Server-R-Services-Samples/tree/master/PredictiveMaintanenceModelingGuide/Data) to walk the user through the main steps from data ingestion, feature engineering, model building, and then finally model operationalization and deployment. The code for the entire process is written in PySpark and implemented using Jupyter notebooks within Azure ML Workbench. The best model is finally operationalized using Azure Machine Learning Model Management for use in a production environment for making realtime failure predictions.
@@ -28,7 +27,7 @@ Following is the link to the public GitHub repository:
28
27
29
28
## Use case overview
30
29
31
-
A major problem faced by businesses in asset-heavy industries is the significant costs that are associated with delays to mechanical problems. Most businesses are interested in predicting when these problems arise in order to proactively prevent them before they occur. This reduces the costs by reducing downtime and, in some cases, increasing safety. Refer to the [playbook for predictive maintenance](https://docs.microsoft.com/en-us/azure/machine-learning/cortana-analytics-playbook-predictive-maintenance) for a detailed explanation of common use cases and the modeling approach for predictive maintenance.
30
+
A major problem faced by businesses in asset-heavy industries is the significant costs that are associated with delays to mechanical problems. Most businesses are interested in predicting when these problems arise in order to proactively prevent them before they occur. The goal is to reduce the costs by reducing downtime and possibly increase safety. Refer to the [playbook for predictive maintenance](https://docs.microsoft.com/en-us/azure/machine-learning/cortana-analytics-playbook-predictive-maintenance) for a detailed explanation of common use cases as well as the modeling approach used for predictive maintenance.
32
31
33
32
This scenario leverages the ideas from the playbook with the aim of providing the steps to implement a predictive model for a scenario, which is based on a synthesis of multiple real-world business problems. This example brings together common data elements observed among many predictive maintenance use cases.
34
33
@@ -38,11 +37,11 @@ The business problem for this simulated data is to predict issues caused by comp
38
37
39
38
* An [Azure account](https://azure.microsoft.com/en-us/free/) (free trials are available).
40
39
* An installed copy of [Azure Machine Learning Workbench](./overview-what-is-azure-ml.md) following the [quick start installation guide](./quickstart-installation.md) to install the program and create a workspace.
41
-
*Intermediate results for use across Jupyter notebooks in this scenario are stored in an Azure Blob Storage container. Instructions for setting up an Azure Storage account are available at this [link](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-python-how-to-use-blob-storage).
42
-
* For [operationalization](https://github.com/Azure/Machine-Learning-Operationalization) of the model, it is best if the user runs a [Docker engine](https://www.docker.com/) installed and running locally. If not, you can use the cluster option but be aware that running an [Azure Container Service (ACS)](https://azure.microsoft.com/en-us/services/container-service/) can often be expensive.
43
-
*This scenario assumes that the user is running Azure ML Workbench on a Windows 10 machine with Docker engine locally installed.
44
-
* The scenario was built and tested on a Windows 10 machine with the following specification: Intel Core i7-4600U CPU @ 2.10 GHz, 8-GB RAM, 64-bit OS, x64-based processor with Docker Version 17.06.0-ce-win19 (12801).
45
-
*Model operationalization was done using this version of Azure ML CLI: azure-cli-ml==0.1.0a22
40
+
* Azure Machine Learning Operationalization requires a local deployment environment and a [model management account](https://docs.microsoft.com/en-us/azure/machine-learning/preview/model-management-overview)
41
+
42
+
This example can be run on any AML Workbench compute context. However, it is recommended to run it with at least of 16-GB memory. This scenario was built and tested on a Windows 10 machine running a remote DS4_V2 standard [Data Science Virtual Machine for Linux (Ubuntu)](https://azuremarketplace.microsoft.com/en-us/marketplace/apps/microsoft-ads.linux-data-science-vm-ubuntu).
43
+
44
+
Model operationalization was done using version 0.1.0a22 of Azure ML CLI.
46
45
47
46
## Create a new Workbench project
48
47
@@ -53,9 +52,25 @@ Create a new project using this example as a template:
53
52
4. In the **Search Project Templates** search box, type "Predictive Maintenance" and select the template
54
53
5. Click **Create**
55
54
55
+
## Prepare the notebook server computation target
56
+
57
+
To run on your local machine, from the AML Workbench `File` menu, select either the `Open Command Prompt` or `Open PowerShell CLI`. Within the CLI windows execute the following commands:
58
+
59
+
`az ml experiment prepare --target docker --run-configuration docker`
60
+
61
+
We suggest running on a Data Science Virtual Machine for Linux (Ubuntu). Once the DSVM is configured, run the following two commands:
`az ml experiment prepare --target [Desired_Connection_Name] --run-configuration [Desired_Connection_Name]`
66
+
67
+
With the docker images prepared, open the Jupyter notebook server either within the AML Workbench notebooks tab, or to start a browser-based server, run: `az ml notebook start`.
68
+
69
+
Notebooks are stored in the `Code` directory within the Jupyter environment. We run the notebooks sequentially, starting on the first (`Code\1_data_ingestion.ipynb`) notebook. When you open each notebook, you are prompted for to select the compute kernel. Choose [Project_Name]_Template [Desired_Connection_Name] and click Set Kernel.
70
+
56
71
## Data description
57
72
58
-
The [simulated data](https://github.com/Microsoft/SQL-Server-R-Services-Samples/tree/master/PredictiveMaintanenceModelingGuide/Data) consists of five comma-separated values (.csv) files.
73
+
The [simulated data](https://github.com/Microsoft/SQL-Server-R-Services-Samples/tree/master/PredictiveMaintanenceModelingGuide/Data) consists of five comma-separated values (.csv) files. Follow the links to get more a more detailed description of the data sets.
59
74
60
75
*[Machines](https://pdmmodelingguide.blob.core.windows.net/pdmdata/machines.csv): Features differentiating each machine. For example, age and model.
61
76
*[Error](https://pdmmodelingguide.blob.core.windows.net/pdmdata/errors.csv): The error log contains non-breaking errors thrown while the machine is still operational. These errors are not considered as failures, though they may be predictive of a future failure event. The error date-time are rounded to the closest hour since the telemetry data is collected at an hourly rate.
@@ -70,23 +85,29 @@ The content for the scenario is available at the [GitHub repository](https://git
70
85
71
86
In the repository, there is a [Readme](https://github.com/Azure/MachineLearningSamples-PredictiveMaintenance/blob/master/README.md) file, which outlines the processes from preparing the data until building a few models and then finally operationalizing one of the best models. The four Jupyter notebooks are available in the [Code](https://github.com/Azure/MachineLearningSamples-PredictiveMaintenance/tree/master/Code) folder within the repository.
72
87
73
-
Next we describe the step-by-step scenario workflow. The end to end scenario is written in PySpark and is split into four notebooks as outlined below:
88
+
Next we describe the step-by-step scenario workflow. The end to end scenario is written in PySpark and is split into four notebooks:
89
+
90
+
[`Code\1_data_ingestion.ipynb`](https://github.com/Azure/MachineLearningSamples-PredictiveMaintenance/blob/master/Code/1_data_ingestion.ipynb): This notebook downloads the five input .csv files, does some preliminary data cleanup and visualization. The notebook converts the data to PySpark format and stores the results in an Azure blob container for use in the feature engineering task.
74
91
75
-
*[Data Ingestion](https://github.com/Azure/MachineLearningSamples-PredictiveMaintenance/blob/master/Code/1_data_ingestion.ipynb): This notebook handles the data ingestion of the five input .csv files, does some preliminary cleanup, creates some summary graphics to verify the data download, and finally stores the resulting data sets in an Azure blob container for use in the next notebook.
92
+
[`Code\2_feature_engineering.ipynb`](https://github.com/Azure/MachineLearningSamples-PredictiveMaintenance/blob/master/Code/2_feature_engineering.ipynb): Using the cleaned dataset from the previous step, lag and aggregated features are created for the telemetry sensors, and error counts, component replacements, machine information are joined to the telemetry data. The failure-related component replacements are used to construct the labels describing which component failed. The labeled feature data is saved in an Azure blob for the model building task.
76
93
77
-
*[Feature Engineering](https://github.com/Azure/MachineLearningSamples-PredictiveMaintenance/blob/master/Code/2_feature_engineering.ipynb): Using the cleaned dataset from the previous step, lag features are created for the telemetry sensors, along with additional feature engineering to create variables like days since last replacement. Finally, the failures are tagged to the relevant records to create a final dataset, which is saved in an Azure blob for the next step.
94
+
[`Code\3_model_building.ipynb`](https://github.com/Azure/MachineLearningSamples-PredictiveMaintenance/blob/master/Code/3_model_building.ipynb): Using the labeled feature dataset, the modeling notebook splits the data into train and dev datasets along the date-time stamp. The notebook is setup set experiment with `pyspark.ml.classification` models. The training data is vectorized, and the user can experiment with either a `DecisionTreeClassifier` or a `RandomForestClassifier`, manipulating hyperparameters to find the best performing model. Performance is determined by evaluating measure statistics on the dev dataset. These statistics are logged back in to the AML Workbench run time screen for tracking. At each run, the notebook saves the resulting model to the local disk running the Jupyter notebook kernel.
78
95
79
-
*[Model Building](https://github.com/Azure/MachineLearningSamples-PredictiveMaintenance/blob/master/Code/3_model_building.ipynb): The final feature engineered dataset is then split into two namely a train and a test dataset based on a date-time stamp. Then two models namely a Random Forest Classifier and Decision Tree Classifier are built on the training dataset and then scored on the test dataset.
96
+
[`Code\4_operationalization.ipynb`](https://github.com/Azure/MachineLearningSamples-PredictiveMaintenance/blob/master/Code/4_operationalization.ipynb): Using the last model saved to local (Jupyter notebook kernel) disk, this notebook builds the components for operationalizing the model into an Azure web service. The full operational assets are compacted into the `o16n.zip` file stored in another Azure blob container. The zipped file contains:
80
97
81
-
*[Model operationalization & Deployment](https://github.com/Azure/MachineLearningSamples-PredictiveMaintenance/blob/master/Code/4_operationalization.ipynb): The best model built in the previous step is then saved as a .model file along with the relevant .json scheme file for deployment. The init() and run() functions are first tested locally before operationalizing the model using Azure Machine Learning Model Management environment for use in a production environment for making realtime failure predictions.
98
+
*`service_schema.json` The schema definition file for deployment.
99
+
*`pdmscore.py` The init() and run() functions required by the Azure web service
100
+
*`pdmrfull.model` The model definition directory.
101
+
102
+
The notebook tests the functions with the model definition before packaging the operationalization assets for deployment. Instructions for deployment are included at the end of the notebook.
82
103
83
104
## Conclusion
84
105
85
106
This scenario gives the reader an overview of how to build an end to end predictive maintenance solution using PySpark within the Jupyter notebook environment in Azure ML Workbench. The scenario also guides the reader on how the best model can be easily operationalized and deployed using Azure Machine Learning Model Management environment for use in a production environment for making realtime failure predictions. Then the reader can edit relevant parts of the scenario to taper it to their business needs.
86
107
87
108
## References
88
109
89
-
This use case has been previously developed on multiple platforms as listed below:
110
+
This use case has been previously developed on multiple platforms:
0 commit comments