Predictive Maintenance and anomaly detection with MATLAB and AI techniques - MATLAB
Video Player is loading.
Current Time 0:00
Duration 1:07:39
Loaded: 0.24%
Stream Type LIVE
Remaining Time 1:07:39
 
1x
  • descriptions off, selected
  • en (Main), selected
    Video length is 1:07:39

    Predictive Maintenance and anomaly detection with MATLAB and AI techniques

    Georg Herborg, Danfoss
    Minh Khoa Tran, Danfoss

    This webinar is Part 2 of the Artificial Intelligence in Industrial Automation and Machinery series.

    Predictive maintenance has emerged as one of the most important applications driving the digital transformation. However, many organizations are struggling to develop predictive maintenance services. According to many studies, this is most often due to lack of required skills or concerns about data quality.

    In this webinar, we will use machine/deep learning techniques in MATLAB to tackle various challenges related to predictive maintenance and anomaly detection. Using data from a real-world example, we will explore importing and pre-processing data, identifying condition indicators, and training predictive models.

    In addition to live demonstrations from MathWorks, Danfoss High-Pressure Pumps will share how they got started with condition monitoring using MATLAB, enabling them to improve the reliability of their pumps and build new data-driven services.

    Highlights

    • Preprocessing sensor data
    • Identifying condition indicators
    • Machine learning for anomaly detection and diagnostics
    • Operationalizing algorithms on embedded systems and IT/OT systems
    • Bridging the data gap

    About the Presenters

    Georg Herborg holds a PhD in Physics from the University of Aarhus within the field of atomics scale studies of metal oxide surfaces. Since then Georg made a career in the Wind Industry with Vestas, taking the role as Director of Tooling, responsible for developing and delivering all wind turbine blade manufacturing equipment. Since 2017 Georg has taken the role as Director of Innovation in Danfoss High Pressure Pumps, accountable for both R&D activities, New Product Developments, Technical ownership of current product portfolio as well as the internal laboratory where products and prototypes are tested and validated. Here Georg has initiated and driven forward a Condition Monitoring Strategy with the clear target to create industry leading tools and insights, that create unique value both for Customers and for Danfoss

    Minh Khoa Nguyen works as a Development Engineer in the Innovation department of Danfoss High Pressure Pumps (HPP). He is a Mechatronics Engineer who is specialized in Mathematical modelling and Control systems, and have been with Danfoss HPP for two years and is a part of their Condition Monitoring team, where he automates data analyses. 

    Antti Löytynoja joined the MathWorks application engineering team in 2010. He focuses on MATLAB applications such as data analytics, machine learning, predictive maintenance and application deployment. Prior to joining MathWorks, Antti was a researcher at Tampere University of Technology (TUT), where he also earned his M.Sc. degree in signal processing. At TUT, Antti specialized in audio signal processing applications, such as sound source localization.

    Rainer Mümmler works as a Principal Application Engineer at MathWorks focusing on Data Analysis/Analytics, Artificial Intelligence, Connectivity to Hardware and on solutions for the Internet of Things. Before joining MathWorks he worked as a wind tunnel test engineer and as a freelancer for various Aerospace companies.

    Recorded: 29 Sep 2021

    Good afternoon, everyone. My name is Gill. And I am head of innovation at Danfoss High-Pressure Pumps. Today we will share with you how we have been using MATLAB to drive forward our condition monitoring agenda. It's worked on in the innovation department and the main contributors are listed here on the slide, [INAUDIBLE], who you will be hearing later on in the presentation, together with Vijay and Christian are the primary contributors to the work that we will be presenting here today.

    Firstly, a few slides about Danfoss and about Danfoss HPP. Danfoss is a global company engaged in a wide variety of industries with products in many different applications. We divide our company into three business segments, what we call Danfoss Power Solutions, which is primarily engaged with oil hydraulic solutions for heavy industry machinery. We have on the right on the slide here, we have our Danfoss Drive Segments, who are developing, manufacturing, and selling frequency drives, variable frequency drives, as well as power converters for the electrification of many different industries these days.

    And then the middle segment on the slide, that was climate solutions to which we belong in high-pressure pumps, is a business segment that is engaged, as the name implies, very much with climate solution initiatives, whether it's heating, cooling, or, as in our case, water hydraulic pumps. It's all a part of that business segment.

    The different strategies for the different business segments are very closely aligned with global megatrends. Some of them are listed out on the slide that we see here. Digitalization, of course, which is also what we will be talking about today with sensors, and data processing, and condition monitoring, but also, in more general terms, the urbanization, people moving into cities. How do we do that in energy efficient ways with clever heating and cooling solutions?

    The supply chain for food. How do we get the food we produce onto our tables at night without much energy consumption and also without much waste of food? Electrification. And then, of course, climate change. Climate change is a big agenda point obviously these days. And as we say at Danfoss, the greenest energy is the one you never use which is why energy efficiency in whatever we do has the top priority.

    Water scarcity is becoming a real issue across the world. Planet Earth is called the Blue Planet for a reason. Most of it is covered by oceans. But that's saltwater, not really accessible to people and to animals. The amount of freshwater reserves in the world has been depleting for decades, whether it's underground water reservoirs or it's freshwater lakes and rivers.

    Droughts are coming also close to the major cities in various parts of the world. This is why fresh water needs to be preserved, it needs to be reused, and it also needs to be produced. And one of the most efficient ways to do that at a large scale is through a process called reverse osmosis where you take seawater and you separate fresh water from the seawater by a membrane process and thereby producing millions of cubic meters of fresh water every hour around the world.

    Here is a snapshot of the product line. In [INAUDIBLE] high pressure pumps, we have axial piston pumps, which are the picture on the left. It's our primary product. It's the one that we make and sell the most of, and it will also be the focus of this presentation here today. But we have other components, small and large, that goes into many different applications, but primarily this desalination market, where fresh water is produced.

    Now an axial piston pump, what is that? Well, as the name implies, it's made of many pistons that all move along the same axis. You see a snapshot of a pump on the left here, where we have a cut open section, and you can see the little pistons inside the pump there.

    Such a pump is extremely highly efficient. It is well beyond the larger ones. We design and manufacture well beyond the 90% efficiency mark. We have even been above 93%, 94%, so it is ultra high efficiency. But there are, of course, limitations to the pump. They're a rare phenomena that, of course, reduce efficiency over time, and can ultimately also cause more catastrophic failures.

    We have to deal with a phenomenon called cavitation, which is the formation of water vapor bubbles inside the pump medium, which can be critical for long term robustness. The leakage through the different small paths inside such a pump from the high pressure side to the low pressure side, is also an energy loss. Then, of course, there are safety issues. We are dealing with hydraulics, with pressurized containers, and we need to make sure they never fail. Not even if someone forgets to tighten the bolt here or there.

    We have then embarked on this condition monitoring journey, where with different kinds of sensors, we have been attempting to pick up signals from pumps in operation to determine their current status. Are they running as one would expect? Or are we able to see small, larger kinds of defects inside the pump? And we are, a long time ago now, it seems a year and a half, maybe two years ago, we did our very first test, where we, with a single sensor, a vibration sensor mounted on the outside of the pump, try to create an experiment to substantiate how clearly we are able to see different faulty scenarios.

    So we took a pump fresh off the production line, just a single one. We started up, had it running, and took some time, domain, frequency, vibration measurements. Then we took that same pump and we introduced air bubbles into it, then we tried to run it in an operational condition that produced the cavitation, as I mentioned before.

    Then we took still the same pump and we exchanged one of the pistons with a worn piston that had the higher degrees of leak rates. And we also exchanged another component inside the pump called a port plate, which was also worn and thereby increase the internal leakage, not by very much. Not by something you would detect on main flow meters, but enough that we knew that it was a difference between a completely new pump and this faulty setup.

    And by simply using statistical features from the time series measurement of the vibration spectrum, we were able to use Classification Learner and saw a really strong alignment between what we predicted the state of the pump was and what it actually was. And that's what you see in the confusion matrix on the lower left hand side.

    This plus 95% accuracy of being able to detect something that has, prior to this moment in time, been completely impossible for anyone to say anything about without stopping the pump and taking it apart. A problem that we then quickly learned we were facing with is that our pumps, they change their nature over time. A completely new pump, when installed and started up, it will have a vibration signature that changes. Not because the pump is degrading, but simply because it's running in.

    And what you see on the middle colored plot here is a principal component analysis of the same statistical features that we used in the previous slide, things like RMS value, standard deviations, kutosis, skewness, and these kinds of things. And you can see here that the older data points, which are the dark blue ones, they lie in a different location on this 2B plot, this principal component analysis plot, than the yellow ones, which are then after a few days of operation. So the whole signature of the pump drifts over time. And this is important to keep in mind because if you want to detect something, and we tried in this case, to create an outlier detection model using a support vector machine principles.

    And if you do that, then you need to be aware that your pump will change its signature over time. To the right on the slot that we are showing here, you then see the data collected over many months of operation, and there are now quite substantial part of the measurement points that lies outside the outlier detection region, not because the pump is worn or wearing or having problems, but simply because it's changing its nature over time. And separating this from real issues is a challenge that we are still working with becoming even better at.

    With that introduction to our first learnings, I will give the word now to [INAUDIBLE], who will take you through the next few slides and give you some more examples on what it takes to create a condition monitoring solution for our products.

    Thank you, Gill. There are three main sections to create what we call a smart pump, where the first section involves finding and validating reliable sensors to measure vibration, pressure, and flow. The next section is to connect the sensors to our data processing. This is where we have dedicated gateway for our data collection. Here we also optimize the data transfer to the last section, which is the signal processing. Here we analyzed the data that for instance, include machine learning and deep learning models.

    To visualize the first section, which is the data collection, look at the picture on the right hand side. Here we have a pump connected to a motor, and we mentioned a pressure and flow at the inlet and outlet of the pump. We also measure acceleration in multiple directions, and these sensors are placed on the housing of the pump.

    All of these sensors are then connected to a dedicated gateway. The architecture of the gateway is seen here. The idea of having a cloud based storage may sound very easy to some, but for us, it can be quite complicated as we need many different parts to be interconnected with each other as we see here. To generalize what we see here, we have a gateway on the bottom left hand side, and that is connected to our cloud storage.

    From here, we can access the data through a data link to process them in MATLAB locally. When finished, we can then create and show the data and results in a dashboard for our customers and ourselves. Now we want to show an example of a small part of a condition monitoring, where we have developed an on-off detection for pumps with the Classification Learner in MATLAB.

    The detection algorithm does what it states. It detects when every pump is running or not based on its vibration signal. This originated from discovering an error in one of our bigger programming codes for analyzing the states and conditions of our pumps. The error involved analyzing and processing data incorrectly because the pump was not running at certain times, and that would give us some false results. In addition to this error, we were told in a customer meeting that instead of having many different drafts of some complicated analysis in our dashboards, they created is something much simpler, just to have an indication of when the pump was running or not, to see the running speed of the pump, and that initialized the work with the on/off detection. We then gathered as much data as we could-- more specifically, vibration data from our pumps. Whether it was from internal test or from our field tests. The reason why we only relied on vibration data, even though we do have other sensors, is to ensure that the machine learning model would work for all pumps as they are all equipped with accelerometers and some do not have the other sensors.

    We see on the right hand side a graph with different vibration signals gathered from nine different palms in nine different environments. These different sections are split by the vertical lines we see here on the graphs. We see here that are many variations in amplitude, noise level and trends, so we can say that each pump is considered unique.

    One may ask if machine learning is necessary for this. Because each pump operates in different environments, we cannot say that the signals will be the same in each situation. Some may be alone in the lab and run by itself without any external disturbance, while others may share room with many other pumps.

    And the vibrations from the other pumps can transmit and affect the readings on the signals of the pump of interest. To ensure to have something fully working for each unique situation, we chose to have a machine learning model. We started making the model by using the diagnostic feature design app in the predictive maintenance toolbox in MATLAB.

    Here we could choose our desired statistical features, such as the RMS, standard deviation, skewness, and kurtosis. On the right hand side, we see a feature trace graph, which may not be too important. However, it shows us that the features are not as simple and homogeneous. So it strengthened our choice in making a machine learning model. To create our detection model, we could generate various results with the Classification Learner app in the statistics and machine learning toolbox.

    From the diagnostic feature designer, we could export the features directly into the Classification Learner. Together with the resulting vector that we created on our own, a machine learning model was easily created as there were generated many different models to choose from. We even see the accuracy on the right hand side.

    While linear discriminant model failed to create a model, whereas the logistic regression model only had an accuracy of 64%. That naturally led us to choose a Gaussian-based model, which has an accuracy of 100%.

    We then tested the model with some new data, and as far as we can conclude, it was a success. There has not been any false positives at all. This simple machine learning model is just a small part of a bigger system, but it is quite important to have these smaller puzzle pieces fully working. Otherwise, we would have looked at something completely incorrect and false. This model is enabling us to filter out data and they let us count the running hours and potentially calculate the remaining useful lifetime of a pump, and will be also be used in other applications within predictive maintenance. That was all for me. Back to you, Gill.

    Thank you, [INAUDIBLE]. And I will now try to wrap up the presentation that we've been through here, summarizing some of the learnings and saying something about the direction that we are heading in. So of course, we have come so far with the understanding of what it means and what it takes to collect data from our type of products, process it in intelligent ways to provide meaningful insights. We have learned that machine learning-- the machine learning toolbox can be extremely powerful, and there it is definitely a big help and a big support that if you are not a data scientist or a programmer by education, then having these tools easily accessible on the MATLAB platform helps you take the first few steps in the machine learning direction with a lot more ease.

    Some very simple models you can argue can yield impactful insights. The on/off detection algorithm seems like a very simple, but very interesting tool, but it proves to us to be extremely important, both to make the remaining analysis work as intelligent and as efficient as possible, but also so that we are able to communicate with our customers what machine learning can do, how we use it, and being able to link that together with something they understand. Is the pump running or is it not?

    We have also faced challenges. Of course, we needed to learn machine learning principles and support vector machine lingo, but we also needed to transport the data from our products out with our customers' applications through the internet, through the mobile phone network, into some cloud solutions, and back down onto our desktops and analysis computers.

    And this was more tricky than we had initially anticipated, and it's definitely a learning, both for us and advice for anyone else that pursues this area of technology to not take that too lightly. Make sure you set it up so that it runs efficiently with very little inputs and with very little maintenance. Then you can spend as much time as possible generating value from data.

    And then lastly, extrapolating from the single case, the one pump that changes its signatures, out into the general case where you have hundreds and thousands of pumps running in many different kinds of applications. That's where most of our focus is lying at the moment to find the generic signatures of failures and strange behavior that we can look for wherever our pumps are installed.

    And that leads me to the future goals. We are now ready to finalize and to rep the insights and the tools and the algorithms that we have developed into an online solution where the analysis happens continuously as the data flows in. And the most important, the most easy to understand, the simple analytics are shown on a front dashboard, both for ourselves, but again to make the communication and the bridge to the customer as easy and as simple as possible.

    And then, of course, to supplement that, we need more advanced analytics running, maybe to a high degree offline on our workstations here at our headquarters in Denmark, generating reports on a weekly, bi-weekly, monthly basis, with more insights on how things are developing over time. And then, yes, more advanced algorithms to see ever more subtle things I think will be a journey that will last for many years into the future. With that, I would like to thank you for your attention and I hope you found the presentation interesting and insightful, and now we're ready to take your questions.

    All right. Are you still there in the next meeting room over?

    OK, thank you, [INAUDIBLE]. So welcome to the second part of the webinar. My name is [INAUDIBLE], and together with my colleague, Reiner, we'll discuss some relevant techniques for predictive maintenance and anomaly detection with MATLAB and AI techniques.

    And we will actually show you some of the tools in more detail that's done for us, for example, used in their research. OK, so here's the high level agenda for today. So first we will discuss some key concepts in the area of predictive maintenance, and after that we will have several examples for different techniques, like anomaly detection, diagnostics and remaining useful life estimation.

    And finally, before the Q&A, I will briefly discuss how you can operationalize your MATLAB models and algorithms on different systems.

    So what does a predictive maintenance algorithm do? So on a high level, it helps us make informed decisions on when we should perform maintenance for the equipment. And this is achieved by analyzing potentially large amounts of complex data. Depending on the type of analysis, predictive maintenance algorithms can answer different questions. For example, is my machine operating normally or not?

    Now the answer to this question is obviously yes or no, and this type of analysis is called anomaly detection. On the other hand, we might try to answer the question, why is my machine behaving abnormally? And this is when we're trying to find out the root cause for the problems, the components or the subsystem, which is behaving abnormally. And this type of analysis is called diagnostics or condition monitoring.

    Finally, we might answer the question, how much longer can I operate my machinery before anything catastrophic happens? And this is called remaining useful life estimation or prognostics. And as mentioned, today we will have examples on all of these techniques.

    Now usually there is a certain kind of workflow when you're developing predictive maintenance algorithms. And this workflow is no different from any other kind of machine learning or data analytics workflow. So you'll start by acquiring data. Your data might be located in some kind of cloud, data warehouses, SQL databases, or perhaps it's only sitting on your local file system. Once you have access to the data, you typically pre-process that. You clean it up, you organize the data, and then, especially in predictive maintenance applications, you typically try to find out or identify some condition indicators which help you describe the condition of the machine.

    And once you have identified the condition indicators, you can then use the machine learning techniques to train models. For example, to estimate the remaining useful lifetime.

    Once you're happy with your model, you obviously then operationalize the model and deploy it to different systems. And this workflow is very iterative, so you'll go back and forth between these different steps. For example, if you're not happy with your machine learning model, you go back to the previous step and you try different condition indicators. And then you train a new model with a new condition indicators. And today, we will try to follow this workflow, but the focus will be perhaps in the steps three, four, and five.

    OK, so let's discuss anomaly detection in more detail. So anomaly detection is a very popular technique because quite often, it doesn't require you to have data from failures. So you can actually train anomaly detection algorithms and models only with normal data. And typically companies have plenty of data from normal operation. So that's why this technique is quite popular. And simply the goal is to identify behavior that is deviating from normal. And if we can do that, then we can keep a closer eye on the equipment and we can perhaps start to plan for maintenance.

    Now there are different types of anomalies. You can have point anomalies, which are simply data points that somehow differ from the rest of the data. For example, if you have vibration data, you might have some data samples where the amplitude of the vibration is much higher than in the rest of the data. You might also have contextual anomalies, which means that a data point is abnormal, only in a certain context.

    And here's an example. So let's say that you're measuring temperatures at the Arctic Circle. Now if you measure the temperature of 15 degrees Celsius, it might not be an anomaly during the summertime, but it's definitely an anomaly during the wintertime. So the time of the year is the context here.

    Finally, we have collective anomalies where a single data point might not be an anomaly as such, but perhaps a combination of data points, perhaps from different sensors, are an anomaly. So what kind of tech methods can you use to detect anomalies? Well, you can use a lot of different techniques. You can use thresholding if you don't have a lot of data, and perhaps you only have a few sensor values available. You can use signal processing. You can use machine learning, system identification, and so on.

    So let's take a look at the first demonstration. So in this demonstration, we're looking at some welding machines, and the goal in this demo is to come up with a machine learning model that allows us to detect anomalies. And what we do know is when maintenance was performed, so we can actually split our data set into two parts-- before maintenance and after maintenance. And in this example, we consider the samples collected after maintenance to be normal, so we trust our maintenance crew, that they have done a good job and we assume that the robots are working normally after maintenance.

    Now the question is, can we come up with a model that can identify the potential anomalies that occur before maintenance with the machine learning model? Let's see. So at this point, let me switch over to MATLAB, and I'm going to run this example from script. And the first thing that I'll do is that I'll bring in some data, and we can also have a preview of the data. So here is our acceleration data, and we actually have three channels. So we have the x, y, and z-axis of the acceleration. And we also have the label which tells us when this data was collected. Was it before maintenance or after maintenance? So here we have the samples collected after maintenance.

    Now we can obviously also visualize the data, the actual acceleration data. So here we are visualizing all the three channels, and we have picked a recording and with the bull curve, we're visualizing the data after maintenance, so that's the normal data. And then the red curve is the data that potentially has some anomalies, so it's been collected before maintenance. And there's definitely a difference there, so there's a good chance that we might be able to differentiate these with our machine learning algorithm.

    All right. So we have quite a lot of data. So we have recordings, which are 70,000 samples long for each channel. We have multiple recordings, so we have quite a bit of data. So before doing any kind of machine learning training, I want to reduce the amount of data. And basically what I want to do is to extract some features that help me differentiate these different before and after data sets.

    And I could obviously use some programmatic commands to extract different kinds of features, but we also have this nice, handy app, called Diagnostic Feature Designer, that allows you to interactively extract a number of features, which are commonly used for predictive maintenance applications.

    But for now, I'm not going to show you the Diagnostic Feature Designer. I'll let Reiner talk more about this tool. So for now, I will just use this function that was automatically generated from the Diagnostic Feature Designer. And this function will compute different kinds of features from our raw data. And using the app, we identified these features to be really good at differentiating these different data sets, before maintenance and after maintenance.

    So let me just run this function. It'll just run for a few seconds. There we go. So now we have this table, train features, and if I look at the values in the table, we see that we have this feature is crest factor, kurtosis, r-miss values, and we have in total 12 features. So four features from each channel.

    OK, so let's now go ahead and train some machine learning models for anomaly detection. So I'm going to hop over to a different script, and I'm just going to clear the workspace and bring in the features that I just computed. Well, actually slightly more. So we have a larger data set available. And also I'm dividing my data set into training and testing sets, so that's usually what you want to do when you're developing machine learning algorithms.

    So you train your models with a subset of your data and then you use a different subset of data to test your algorithms. OK. Before training any models, let me just use this diagram to explain what kind of techniques you can use when you have different types of data. So here on the y-axis, we have the availability of anomalies. And on the x-axis, we have availability of labels. So if you have unlabeled data, and you know that you have both normal and abnormal data in your data sets, you could use clustering techniques or

    some kind of unsupervised learning techniques to group your data. If you only have normal data available and you know that it's normal, then you could use techniques like neural networks, especially the autoencoders. Based on neural networks, you could use some distance based methods to identify anomalies in the new data, or some thresholding techniques.

    But if you have labeled data, and you have a fairly balanced data set where you have, let's say equal amounts of normal and abnormal data, then you could actually use supervised learning. And this is the case with our data. So we have the labels for our data, so we could actually use supervised learning techniques.

    And we actually tried that out. So we use the Classification Learner app to train some classifiers, and we actually got some really good results. So the bagged decision trees, they actually provided a model with 100% accuracy. So this seems to be a feasible way forward.

    But in many cases, we don't have failure data or abnormal data available, so we only have normal data. So in the rest of the examples, I'm going to pretend that we only have normal data available, and then I will use my abnormal data, which was collected before maintenance. I'm going to use that data only for testing purposes to validate that my model can actually find some anomalies in the data.

    OK, so the first technique that I want to try out is the so-called one class support vector machine. So this is a specialized version of a regular SVM or support vector machine, which is used for binary classification. In one class SVM, the algorithm finds a boundary that encloses the training data samples, in this case, the normal samples as tightly as possible.

    All the samples that are then mapped outside of that boundary get a normality score below 0, and those are thus considered as anomalies. So the first thing that I'll do here is that I'll extract only the samples after maintenance, so we will use only normal data to train our one class SVM.

    And then we call the feet CSVM function, passing our training data. And the targets here, those are simply only ones. And this means that we only have one class in our target, so we don't have, for example, like a binary class in binary classification problems. So we only have one class.

    And then with the trained model, we can make some predictions. We can pass in our testing set, which in this case, includes both normal and anomalous data. So we basically get the score values for each sample, and then we pick the scores, which are below 0, so we find the anomalies.

    And then we can use the confusion chart to actually compare our predictions against the ground truth. So let's run this and see what kind of results we get. So here we see the confusion matrix. So it looks like we're getting pretty good results, so we see that when the true class is anomaly in our testing set, our model is actually 100% accurate, so we're predicting anomaly.

    However, when the true class is healthy, in 7% of the cases, we're actually labeling those or tagging those samples as anomalies. So we have some false positives, but overall the model is actually quite accurate.

    OK, so then we could try another technique. So the next technique that I'll use here is so-called isolation forest, which is basically a specialized version of an ensemble of decision trees. With isolation forest, each training sample is isolated into a leaf of its own.

    So here we have an image of a small piece of a decision tree, where the ends of the branches are called leaves. And with an isolation forest, the normality score of a sample is decided on the number of decisions or splits on the way to the leaf. So here we have one, two, three splits before we get to this leaf. And usually anomalies have fewer splits than normal samples, and that's because usually the anomalies are somehow separated from the normal samples.

    All right, so let's train an isolation forest anomaly detection model. So once again, we'll use a function from the statistics and machine learning toolbox. In this case, I forest, we pass in our training data, which is only the normal samples we get our model. And then we can find the anomalies found by the model. So we basically make some predictions with the testing set. And once again, we can use the confusion chart to look at the results.

    And here we have the results. And overall, this looks also pretty good, although with the one class support vector machine, we had 0% here and 100% here, so also 7% here, so it looks like this is not quite as accurate as the one class support vector machine.

    But we do have some hyper-parameters of the model that we could potentially tune with our testing data. So for example this contamination fraction, which is basically the fraction of expected anomalies in our data sets, we could try to tune this further to get some better results. But right now it looks like it's not as accurate as the one class SVM.

    But we can try some other methods as well. So we could use, for example, something called robust co-variance. And this is basically a distance based method where we are looking at the Mahalanobis distance. And basically this method estimates the mean of the data set, but it does that in a robust way, so basically the anomalies and the outliers do not affect the mean.

    And then we're basically simply calculating the distance of the data points to the mean. And obviously those data points that are far from the mean, those are considered as anomalies. So let's try this one out. And the results don't look very good.

    And this method is actually such that it works better with data sets where you only have very few anomalies, but in our data set, we actually have quite a lot of anomalies, so it's almost a balanced data set, so it could be that if we had a different kind of data set, this method would work better.

    OK, and finally what we can do is that we can perhaps do some comparison between these different methods. So we can use, perhaps, some scatter plots to visualize and compare these methods.

    Before doing that, what I need to do is that I need to reduce the dimensionality of our data set. So we have 12 features in our data set, so I'm using the t-SNE method here to reduce the dimensionality into two, so that I can plot those data points using scatter plots.

    So here we have those plots on. Over here, we have the ground truth. The red markers are the abnormal samples, and the blue-- sorry, the black markers are the normal samples.

    So here we see that this plot over here, this is quite similar to the ground truth, and that's because the isolation forest was pretty good at identifying those anomalies. And same thing with the one class SVM. So we have some mix up here and there, but overall, the one class and the isolation forest, they worked pretty well.

    OK, so perhaps a quick summary. So in this example, I showed a few different techniques, anomaly detection methods and models that you can train with normal data. And typically, when you're developing anomaly detection algorithms, it's a good idea to try many different techniques so that you can identify the one that works for your problem the best.

    All right, but at this point, I would like to hand it over to Reiner, who will continue the discussion and show you some additional demonstrations. Take it away, Reiner.

    Thanks, [INAUDIBLE]. So I will continue with two demos, or they are based on a case study. A flow pack machine and a flow pack machine is basically part of package machine, pushing boxes on a conveyor belt. And as you imagined, it is important that we are able to detect any fault on the electrical side on the mechanical side. And it's also important to know how much time we have before this machine folds.

    So what we will use is a digital twin to generate the [INAUDIBLE] data. For example, model current, model speed can be used as data. Pre-positioned a little bit, and after pre-processing the data, we will extract condition indicators features, which allow us to describe the health condition of our systems.

    But that we build classification model to distinguish between electrical and mechanical issues and we will all the users condition indicators to build a remaining useful life estimation model. And this model will indicate how much time is left with a certain probability until a [INAUDIBLE] will occur. And I will also give an outlook how you can use these models in the deployment process.

    So we just saw [INAUDIBLE] example of an anomaly detection. We now have a closer look at condition monitoring and using predictive maintenance algorithms. We are able to understand what is not working in the real system and why. In particular in this case, we can build models that can detect and diagnose failures on the server model the electrical side, and on the gearbox, the mechanical side. So let's move to MATLAB.

    So I will show you the classification example using this live script using apps and using a video. Focuses to identify the condition indicators and to train the model that we are using data generated by Simulink model. And before we build and test the predictive maintenance model, we have to extract features. I will show you two approaches. One is programmatically in the slide script. The other one is an app-based approach. And from this programmatically approach, we have to standardize the data that can be used for the machine learning techniques.

    When we look at their workspace, we have a table. The things you see here, we can plot the features onto a plane, and when you look at the scatter plot, you see that you can distinguish between the fall called five act. And two, for example, but it's more difficult between four and five. So therefore we have to use machine learning techniques.

    Important steps are the feature reduction and the election. Election, reducing features, safe storage, and computation time, and make their sites easier to understand.

    Common techniques include principal component analysis, or correlation matrix that will show in the next section. Very important, although the featured election is especially useful when you're dealing with high dimensional data or when your data set contains a large number of features. And therefore MATLAB offers or feature selection techniques. We

    Will show you the neighborhood component analysis-- [INAUDIBLE]. So first, have a look and check if the features are correlated to each other. And when we have a look at the correlation matrix, you see that there are features two and three, four and five are correlated, so in others, so we will remove that feature from our table. And when we have a look at the workspace, you see that we reduced it to 24.

    Next important step is to select the features, and to select the features of the most influence for our classification, so we use our NCAA labor component analysis. And in this stamp plot, you see the rates, and we will choose our weights are of example above one. We can achieve this with this slider here, and let's execute the perfection, and then you see that we reduced our future data for training to eight features, and number nine as a full code. This can be used for the next step to the classification model.

    But as I said, we will first see another approach to extract features, and we use this Diagnostic Feature Designer. This is an app which helps you to automate this process, or as you see, it's an app based-- it goes from the left to the right, and you can distinguish between different features. So I will show this in a video in terms of time, so let's go to the video.

    So we imported their signals arrow motor current speed. First step can be to visualize all the signals. You can group the signals by fault code and you can repeat this step for the other signals. It will be important. So I skipped this step, and we will show how to create a power spectrum, which we'll use later on for the spectral features. You can select different models to be used. You can change the model or the approach. And yet, then you can easily plot the results.

    Again, you can group the power spectrum by fault code, and then you can repeat this for other signals, as well. So let's generate some time to make features, so see here, or you can select different features, [INAUDIBLE] statistic like mean, and RMS, select and de-select what kind of features you want to be processed. And then you see some of the features that have been processed. You see it on the features table the light on the left. And you'll see some histograms where you can see how good a feature can be distinguished between the others.

    OK, and you can repeat this for the other signals as well, but we'll move on to other spectral features. [INAUDIBLE] the spectrum, you want to generate and then you have also different options, which features should be generated. Again, click OK, plot the result, and they are ready to the feature table. And can you see the histograms for the spectral features.

    Repeat this for other spectrums, as well, and then the final step is to rank it by importance. You see a one way ANOVA ranking techniques, and you see you can use maybe the five most important. You can select the features, and then export it directly to the MATLAB workspace, or to the Classification Learner I will show in a few minutes.

    So now we created the features. Now we use another app, the Classification Learner app. I will show you how you can use this. You can load in the feature data training data set. You see the response variable default called the protectors. You can use different validation schemes, for example, cross-validation. And then you can select, de-select features.

    You can choose several different models, and you don't have to be a data scientist expert, so you can, even if you don't know the difference between a decision tree and a support vector machine. You can just train. There are models and MATLAB calculates the accuracy or in terms of time. I use all quick to train models. And you see in the left side, the models appearing, and the accuracy. You see the left button side on a summary of the models. And then you can use plots to see how good your model is behaving.

    And when we have a look at the first one, you can see this confusion plot. And if you think the result is good enough, then you can use this result to generate a function out of it and export it.

    So let's see if we have better ones. So here we have got nearest neighbor, the higher [INAUDIBLE], so we will use that one to generate a function, and MATLAB automatically generates the function. You see he has a fit nearest neighbor classifier, and then you can use this function again in your script to predict something. So we will save that one.

    That's a train classifier. You can use it on a lot of script. Of course, you can also export our model. Here are the different options. For example, deployed to cloud based products and server, deployed for as a compact model for coaching reason, or just for using MATLAB. So again, you can deploy it, export it, and then you can use this again in the script to test it.

    And you see here, I will use a clean classifier. When we see the validation [INAUDIBLE]. Is that before, or that it will also show briefly how you can deploy this classification model, for example, to industrial policy. You may see be in our configuration under this block. You can include MATLAB script, and you see, you can load this compact model into their a Simulink model and then deploy it to the PLC. If you would like to know more, then we have several talks about this in our webinar section. Though that brings media into the classification. [INAUDIBLE] will move on to remaining useful life.

    So in the second demo, I will show you how to create a remaining useful life algorithm, what are the steps, so going back to MATLAB. So again, we will use a live script for the rule estimation. I have already executed the first sections to save some time, so we loaded in the data. We created our own file and sample data store.

    We visualized the data. We saw the failure is happening just after week 19, so we skip all the data before, and then we do some pre-processing and feature extraction using power computing. And finally, we have our feature data set form for the remaining useful life estimation. Again, we did some feature reduction to remove their highly curated features, and with that become to the action feature importance ranking.

    So an appropriate condition indicator should ideally respect three properties-- that monitonicity, trainability, and prognosability. So essentially, a good condition indicator's monotone, and it's derivative increase in a predictable way as it gets closer to the future.

    We only use training data for wrangling the features, this is the only data available to us. So let's see and consider monitonicity, so when we plot the monitonicity, more training data, we see that there are clearly some features who have our monitonicity lower than a certain value, we can exclude them, and that's all their advantage. So we don't have to view them when we are measuring data from the real system on the test.

    As you see now, we reduced our data set and only have six out of 27 initial features. Again, we have to standardize our data to use some machine learning techniques like SSPCA, and we throw their principal company analysis on their own on the data.

    And we see that the first two components explain almost 100% of the data sets. So we will use them and we check them for monitonicity. And as you see here, when we check them, you see clearly that only component one is clearly monotone. And we will use this at the health indicator for our machine.

    And when we visualize all the health indicator, we see here, it's clearly iterating, beginning from week 90 until they're a certain threshold.

    So let's summarize what we achieved up to now with our results based on the training data. And in a realistic scenario, you would do, when your data comes in, for your machine on the test, or whether they're achieved results. You would only evaluate a reduced number of features. Yeah, you would normalize them through the normalizing mean and standard deviation obtained during the training, merge them through the PCA coefficients attracted from training data, select only the first principal component.

    A quality health indicator is PCA 1 minus the initial value of pain from training data, and use that as an health indicator in order to predict their [INAUDIBLE] the machine on a test. And you need this threshold, and how you can obtain this threshold, maybe you have knowledge of your system. Maybe you have data obtained from some past features of the same or similar physical machines. Or as we did, you can obtain the data from simulating a simple skip model of the machine on the test.

    And I've done this before. I got a threshold about 115, and we used the threshold for the remaining useful life estimation. We use an exponential degradation model. As you see here, we create the remaining useful life model, and then we test the model. We use it to predict roof and the output methods to predict the remaining useful life and up to the parameter distribution as new data comes in.

    So let's write this function. And then you see it was a station starting this week 100, and you see there are estimated remaining useful life or you see the confidence interval. This is getting closer, and you also see the lower plot or the PDF of their remaining useful life.

    And this brings me to the end of their demo for the remaining useful life. So let's go back to our slides.

    So we showed you three demos or anomaly detection, classification, remaining useful life. The final part is always to deploy these models into operation. And what do your end users expect? Do they expect that you, based on your algorithms you created, they need your dashboards, simple, quick information that your operation needs a bird's eye view?

    Do we have to integrate with iterative systems, using data sources, streaming data, analytics platforms, or even to the customers to your customer's expect easy to digest information like automated reports. So MathWorks can help you on all these three points.

    So if you want to deliver your analytics to different users, there are probably two approaches we can offer to enterprise systems or integrate with other environments using our MATLAB Compiler technology, and also when you go to target-embedded hardware. It's now possible to use AI models and deploy them on different targets as you see here, like CPUs, GPUs, FPGAs, or on PLCs.

    So we showed you how you get from data to decisions, how the operative maintenance workflow can be used within MATLAB. We used digital trends to generate synthetic failure data, and we also gave a brief outlook on how you deploy your algorithms.

    So MATLAB can help you and be an end-to-end solution from access and pre-processing the data to develop improvement models to deployment of your models in production. Use Simulink to generate training data in the absence of real failure data. And you can start quickly.

    So we can help. We have references, examples, tech talks, as you see here, and also we have departments, which are happy to help you to get started on the whole entire predictive maintenance workflow. So MATLAB and Simulink enables you, as an engineer, or the data scientist to quickly create and test and implement predictive maintenance programs. Well, thanks for your attention. Bye bye.

    View more related videos