Machine learning is currently on everyone's lips across all industries. The detection of errors in production and manufacturing processes as well as the predictive planning of maintenance measures are only some of the drivers that drive the application of analytical methods or the use of artificial intelligence "AI". The application of data science methods, such as machine learning, says a lot about the past behavior of machines, processes and people. It also enables predictions to be made about predictive analytics methods.
How does this complicated-sounding machine learning work at all and how can one test the applicability to one's own Question?
We therefore want to approach this complex environment step by step by creating a demo and training data and point out the expected added values. We use special cloud services from Azure (Microsoft Azure is a cloud computing platform from Microsoft) to illustrate the possibilities.
In order to build confidence in analytical methods, it makes sense to create test and training data that can be tested in the first step. Various approaches are conceivable for this. In our example we prepare the data in Microsoft Excel. Here we generate measured values that show us a production error if a certain temperature value is exceeded or not reached, as well as a range within specific limits. Specifically, if the process temperature exceeds 16 degrees, falls below -16 degrees and in the temperature range from -5 degrees to +5 degrees, an error occurs in the manufacturing quality.
Figure 1: Temperature-dependent malfunction of a Motor
To simulate this, we create an Excel file with two columns. One column for the recording of the temperature values, later determined by a corresponding sensor. For demo purposes, we generate random temperature values from -100 degrees to +100 degrees. This is done with the help of a simple Excel formula (=RANDBETWEEN (-100;99) + RANDBETWEEN (0;999)/1000). In a second column we describe the state of a motor unit. Here we record whether there is a fault at a corresponding temperature or not. We also describe the malfunction with a simple formula that considers the described threshold values and temperature ranges.
Figure 2: Prepared test and training data
We then convert this formula-based evaluation into an ASCII-based file (CSV format) and thus remove all formulas and only retain the values and the statement as to whether there is an engine error. This step completes the preparation of the training and test data.
Azure Machine Learning Studio is a powerful cloud-based predictive analysis service that enables you to quickly create predictive models and deploy them as analysis solutions.
The first step in working with the Learning Studio is to create a so-called Azure Machine Learning Studio Workspace. A workspace makes it possible to create and manage machine learning experiments and predictive web services. Several workspaces can be created, which then contain the experiments, datasets, trained prediction models, web services, etc. As the creator of a workspace, we can invite other users to share the workspace and thus provide the created solutions for predictive analysis.
We used the Azure Machine Learning Studio in the step before to develop a predictive analysis model. We then make the logic available to the Azure Machine Learning Studio Web Service. The predictive web service can then easily be used by user-defined applications or BI tools such as PowerBI, Excel, Flow or similar.
But let's take it one step at a time. Here is a short "step by step" guide to get the required result and make a prediction of the failure of an engine depending on the temperature.
First we need an Azure Account. This can be set up as a demo account on the https://azure.microsoft.com/en-us/ -Portal, free of charge. Afterwards we can Login via - https://portal.azure.com. A dashboard will open from which all Azure services can be viewed.
On the left side we can then create a [Create Ressource]. Here we select [Machine Learning Studio Workspace].
Figure 3: Create workspace
For the creation of the workspace, some information such as a storage account must be provided. In this configuration view, all data can be entered directly or missing areas can be created. For a quick start, it is recommended that the suggested Settings be accepted. After everything is configured, the workspace is created. The progress can be viewed under [Notifications] and the newly created resource can be opened directly on completion.
Figure 4: Creating and opening a Machine Learning Workspace
After opening the resource you can start the [Machine Learning Studio] (see picture gallery).
Figure 5-8: Picture Gallery on how to start the Machine Learning Studio
After the data sets are available in Azure, we create a new [Experiment]. For this, click on [New] and create an empty experiment [Blank Experiment]. Then the workspace should appear as shown in the following figure.
Figure 9: Experiment created
Now we can add function blocks to our experiment using the drag and drop functions. The available blocks can be selected from a treeview on the left side and are simply "dragged" into the workspace.
Figure 10: Populating the experiment
First, we add our test data to the experiment. In the next step we divide the data into two areas using [Split Data]. One half of the data is used to train the model. The other datasets are used to test the trained model. The percentage divided into test and training data can be set as a rule of thumb with 70 percent training data and 30 percent test data. The next step is to select a suitable algorithm. In our case we select the [Two-Class Boosted Decision Tree].
What is a Decision Tree?
Learning decision trees uses a decision tree (as a predictive model) to go from observations about an element (represented in the branches) to conclusions about the target value of the element (represented in the sheets). It is one of the predictive modeling approaches for statistics, data mining and machine learning.
We then connect the data points at the edges of the function blocks with each other: We connect the output of the DataSet with our module to divide it into training and test data. Next, we add the training data (output of the split-data module) and our chosen algorithm to our training model. Then we have to tell the training model which column to "train".
Figure 11: Specify column for training evaluation
After successful selection, the trained model and the test data derived from the dataset are evaluated in the function module [Score Model] for reliability of the prediction. In order to do this, the model must first be calculated. This is done by right-clicking on the Score Model block and executing the [Run selected] function.
Figure 12: Calculate model
Shortly later, the calculation result is available and can be viewed with [Scored dataset / Visualize].
Figure 13: Comparison of training data with forecast data [scored labels]
The result can then also be made available via WebService.
Figure 14: Deploying WebService
To do this, click on the [Set Up WebService] button. Thereupon a possibility for the input of temperature values via web interface is created. The work area is automatically extended by a [Predicitve experiment] tab. The automatically added function block [WebService input] can now be seen here as the input variable for the function block [Score Model].
Figure 15: Web Service Output
Furthermore, based on the model data, the failure of the engine is predicted. The data can then be queried using the [WebService output]. To make this procedure available, a calculation run using [Run] is necessary and then the [Deploy WebService] must be called.
Figure 16: Deploy WebService
Once this has been successfully completed, temperature values can be entered to query whether a motor failure will occur on the basis of this trained model.
Figure 17: Calling the WebService Input via test page [automatically generated]
Via the automatically generated test page, the input data can be entered via [Test] - in this case the temperature. The response of the Web Service Output can then be viewed in the lower area.
Figure 18: Uncritical temperature value
For the demo query, 10 degrees were entered here. Then you can read the value "FALSE" in the third column. This means that no failure is predicted at this temperature.
In the next example a temperature value of 4 degrees is selected. You can now read a "TRUE" in the result, which indicates a failure.
Figure 19: Critical temperature value
It is very easy to take your first steps in machine learning with the Azure Machine Learning Studio. It has been shown how to teach and make artificial intelligence elements available by simply configuring available function blocks without in-depth programming knowledge. The convenient provision of WebServices also facilitates the integration of forecast results into the applications. In further articles we will focus on different algorithms, as this article is only intended to give a first impression. The areas of monitored and unmonitored learning will also be covered in further articles.
We are happy to take up suggestions for topics and articles and deal with them.
Feature Image source: https://pixabay.com/de/netz-netzwerk-programmierung-3706562/