scieee AI-readable full text Open interactive document viewer

Predictive Maintenance use case employing Survival Analysis in a telecommunication company

Costa, Marta Carocho de Sousa

Abstract

Driven by the digital revolution, telecommunications companies need to adopt innovative technologies and services to be competitive. In this context, the company invests in its first Predictive Maintenance solution, intelligent anticipation of device failure through sensorial data. This solution has the power to anticipate and plan Reactive Maintenance measures that extend equipment’s life, reduce downtime, aim for cost savings, and avoid negative feedback, consequently improving the service quality. This project explores a Fault Prediction tool such as Survival Analysis. It undergoes the six phases of a Data Science Project following the CRISP-DM methodology. For applying the Survival Analysis technique (e.g. Kaplan-Meier), it is crucial to identify two key events using the equipment’s historical data (e.g. STB): The beginning of the anomalous event and the exact moment of the fault event. Several techniques, such as Statistical Smoothing models and Anomaly Detection models, were analysed and compared in detail to detect the beginning of the device malfunction. The best results to detect the devices’ anomalous event were employed by a Statistical technique, the SMA where the anomalous event is reaching 50 degrees for the one-day smooth average. Therefore, it is possible to obtain an acceptable anticipation period of 38 days for future equipment maintenance intervention. In this sense, employing a Predictive Maintenance solution guarantees the reduction of 71% of the actual emergency interventions. Consequently, the company saves more money rather than not making any prediction at all. Moreover, it was also developed a visualisation tool to demonstrate the solution and explore it, where it employs the different models to detect the beginning of the anomalous event’s. Consequently, all the proposed goals of the company were accomplished.

Full text

1 Predictive Maintenance use case employing Survival Analysis in a telecommunication company Marta Carocho de Sousa Costa Internship report presented as the partial requirement for obtaining the Master’s degree in Data Science and Advanced Analytics A big thank you to all my friends and family. NOVA Information Management School Instituito Superior de Estatístia e Gestão de Informação Universidade Nova de Lisboa PREDICTIVE MAINTENANCE USE CASE EMPLOYING SURVIVAL ANALYSIS IN A TELECOMMUNICATION COMPANY by Marta Carocho de Sousa Costa Internship report presented as the partial requirement for obtaining the Master’s degree in Data Science and Advanced Analytics Advisor: Prof Doutor Flávio Luis Portas Pinheiro External Advisor: Doutor Luís Carlos Santos 03 2021 v Abstract Driven by the digital revolution, telecommunications companies need to adopt innovative technologies and services to be competitive. In this context, the company invests in its first Predictive Maintenance solution, intelligent anticipation of device failure through sensorial data. This solution has the power to anticipate and plan Reactive Maintenance measures that extend equipment’s life, reduce downtime, aim for cost savings, and avoid negative feedback, consequently improving the service quality. This project explores a Fault Prediction tool such as Survival Analysis. It undergoes the six phases of a Data Science Project following the CRISP-DM methodology. For applying the Survival Analysis technique (e.g. Kaplan-Meier), it is crucial to identify two key events using the equipment’s historical data (e.g. STB): The beginning of the anomalous event and the exact moment of the fault event. Several techniques, such as Statistical Smoothing models and Anomaly Detection models, were analysed and compared in detail to detect the beginning of the device malfunction. The best results to detect the devices’ anomalous event were employed by a Statistical technique, the SMA where the anomalous event is reaching 50 degrees for the one-day smooth average. Therefore, it is possible to obtain an acceptable anticipation period of 38 days for future equipment maintenance intervention. In this sense, employing a Predictive Maintenance solution guarantees the reduction of 71% of the actual emergency interventions. Consequently, the company saves more money rather than not making any prediction at all. Moreover, it was also developed a visualisation tool to demonstrate the solution and explore it, where it employs the different models to detect the beginning of the anomalous event’s. Consequently, all the proposed goals of the company were accomplished. Keywords: Predictive Maintenance, Survival Analysis, Anomaly Detection, Fault Prediction vii Contents List of Figures xi List of Tables xiii Acronyms xv 1 Introduction 1 1.1 Project Goals ................................. 3 1.2 Structure and Methodology ........................ 4 1.3 Company overview ............................. 5 2 Theoretical Framework 7 2.1 Data Understanding ............................. 7 2.1.1 Time Series data ........................... 8 2.2 Data Preparation ............................... 10 2.2.1 Data Cleaning ............................ 10 2.2.2 Data Construction: Statistical ................... 11 2.2.3 Data Construction: Anomaly Detection ............. 12 2.3 Modelling - Survival Analysis ....................... 17 2.3.1 Kaplan-Meier ............................ 20 2.4 Evaluation .................................. 21 3 Project Development 23 3.1 Data Understanding ............................. 24 3.1.1 Data Description .......................... 25 3.1.2 Data Exploration .......................... 27 3.2 Data Preparation ............................... 31 3.2.1 Data Cleaning ............................ 32 3.2.2 Data Construction .......................... 34 3.3 Data Modelling and Evaluation ...................... 39 3.4 Deployment ................................. 43 4 Conclusions 47 4.1 Report Evaluation and Lessons Learned ................. 48 ix ACRONYMS SA Survival Analysis SAS Statistical Analysis System SEMMA Sampling, Exploring, Modifying, Modeling, and Assessing SMA Simple Moving Average SPSS Statistical Package for the Social Sciences SR Spectral Residual STA Statistical Approach STB Set-Top Box xvi Chapter 1 Introduction "In the long run, all machines break down" - Maynard Keynes Nowadays, telecommunications companies, also known as Communication Service Providers (CSP) face an oppressive pressure to compete for costumers leading to a constant demand to innovate. Indeed, CSP ’s competed in a saturated market populated by young companies that rely on the empowerment by the new Internet Of Things (IoT) technologies (e.g. sensors), which provide real-time access to large scale datasets. The access to the equipment’s hardware data enabled to reduce of the number of claims. As stated by Autoridade Nacional de Comunicações (ANACOM) [3] the Portuguese telecommunications companies’ customer claims on the first semester of 2020 were respectively 21% and 8% for customer service and equipment faults. These type of claims are critical issues since "the network equipment reliability is one of the major critical issues for telecommunication operators, not only because it may affect the company’s outlook in terms of customer service and reputationbut also because the repairing activities can be extremely expensive", according to Andrea from Hewlett Packard Enterprise [19]. Figure 1.1 exemplifies these client claims of the equipment hardware fault. Let us assume, within a CSP client’s residence, his Set-Top Box (STB) (that enables cable or satellite television broadcast) stopped running for an unknown reason. Therefore the client has to call the CSP technical support and ask for the equipment to be repaired or replaced. The technician has to reply to the customer within an urgent time frame of 48 hours according to service level agreements [1][2], including both the technician’s travel time and the box repair or replacement. The technician can probably exceed the repairing time, which leads to overtime labour. For each extra hour, 1 CHAPTER 1. INTRODUCTION Figure 1.1: A RM example: STB running for an unknown reason and the client has to call to the technical support, this unplanned intervention is more expensive than scheduled one for the company. the company pays an additional fee of 50 euros, unlike the scheduled interventions that are 25 euros per hour as stated by ANACOM [1][2]. During that time frame, there are unsatisfied costumers without service. Consequently, this leads to two significant problems: The customer may churn, meaning he can abandon the company to a competitor and the company loses money with each new unplanned intervention are more expensive. Currently, on the telecommunication company where this internship took place, these urgent interventions are treated with the Reactive Maintenance (RM) strategy [28] where the maintenance operation occurs after a failure or a break-down as the example in Figure 1.1.RM is the most straightforward method to employ and understand, with no meaningful effort to implement within companies. Still, it is too costly due to the increase in the human task force the OPEX. To improve on this domain, the company needed to answer the following question: "How long will equipment live before a failure event happens?". This answer would allow anticipating the faults on services and equipment’s before they happen. In this sense, the Predictive Maintenance (PM) strategy appeared since it optimises the intelligence of the network planning and operations by using the analytical capabilities that take advantage of the mathematical algorithms of Artificial Intelligence (AI) and Machine Learning (ML). One possible solution for employing this strategy is using a Survival Analysis model that estimates a Survival Curve indicating the equipment’s probability of surviving at a particular time based on an anomalous event. Although these automation techniques are now beginning to emerge on the networking and service domains within telecommunication operators, PM strategies, have proven to be 35% more cost-effective than employing RM strategy, as reported by TEOCO [13]. This improvement is only possible due to the access to historical and real-time data that records the machine’s process to fail. Consequently, by reinforcing the advantages mentioned before, it is possible to avoid the increase in complaints, churn of clients, profit and maintenance costs. 2 1.1. PROJECT GOALS Description Location Goal 1 Identify, understand and apply Data Science models and concepts to solve the PM problem; Chp 2: Theoretical Framework & Chp 3: Project Development Goal 2 Obtain an acceptable anticipation period for at least 70% of the possible urgent interventions; Chp 3: Project Development Goal 3 Demonstrate the solution in an uncomplicated form, using data visualization tools . Chp 3: Project Development Table 1.1: Identification of the company’s main three goals that goes through the theoretical, resolution and visualization for solving the PM problem; and their respective location on the report. 1.1 Project Goals This project report aims to contribute to the first Predictive Maintenance strategy within the company using Survival Analysis (SA) technique to anticipate an acceptable period before the STB failure happens and for the technical team to arrive at the customer residence. This initiative project’s outcomes will enable (if successful) to have a long-term project based on more resources. In order to guarantee that accomplishment, it is essential to establish with the company the main goals to fulfil by the end of the project period, that is, between March and July of 2020. Whereas this period restricts the project development to some concepts, time and available resources. Table 1.1 describes each of the proposed three main goals, and the column Location indicates where each goal’s development can be found on this report. All the milestones together pass by all the domains that a PM strategy should have, employing a Predictive algorithm, more precisely the SA technique. Each goal aims to answer the following questions, respectively: ”How to do it?” describes the essential research techniques to solve the proposed problem; ”How to solve it?” contains the resolution by employing the acknowledge theoretical techniques, which is only successful if it reaches that acceptance criteria referred on the Table 1.1; and finally ”How to demonstrate it?” contains the visualisation and the demonstration of the obtained results using the researched techniques. Moreover, it will be introduced an extra milestone on the Project Development Chapter 3that is not represented on Table 1.1. 3 CHAPTER 1. INTRODUCTION Figure 1.2: The structure of this report following the CRISP-DM methodology created by Chapman [20] divided into six different phases developed within three distinct chapters. 1.2 Structure and Methodology The report follows a methodology containing all the six phases of a project’s life cycle. Based on the Cross-Industry Standard Process for Data Mining (CRISP-DM) methodology, created by Chapman [20]. Founded in the year 2000 for systematising processes, it has become one of the most recognised methodologies for data science, analytics and data mining. There is another similar methodology, Sampling, Exploring, Modifying, Modeling, and Assessing (SEMMA) developed by SAS Institute [0]. Still, CRISP-DM, proof to be the proper solution for this business problem, as shown in this SPSS software step-by-step guide [20]. This structure is displayed in Figure 1.2 in order to accomplish the aforementioned goals through acceptable practices. These phases are Business Understanding, Data Understanding, Data Preparation, Modelling, Evaluation and Deployment. All these six phases except for the first are extended into the two subsequent Chapters 2and 3, Theoretical Framework and Project Development. At the beginning of this Chapter 1, describes the business challenge, thus addressing the first phase. The subsequent phases from flow Figure 1.2, are addressed on a theoretical level in the Theoretical Framework (Chapter 2). In Project Development (Chapter 3), each phase is presented in detail in terms of applying the preferred techniques alongside with the respective results and discussion. 4 1.3. COMPANY OVERVIEW Finally, the Conclusions (Chapter 4) contains a brief reflection on the achievements and improvement points, the project’s outcomes, and what is left as future work. 1.3 Company overview The company associated with the project is known for delivering high-tech transactions, solutions, products, consulting, technology services, system integration and managed services. This company, linked with a significant Portuguese company of Information Technology, develops and implement technology solutions that help CSP under Digital Transformation. Their methodology basis reduces the risk in IT projects and achieves a high success rate. The company comprises teams specialised in Business Support Systems, Operations Support Systems, IoT, Digital Television and Unified Communications. They work in different offices, such as Lisbon, Oporto, Newbury, Dubai, and Dusseldorf; It employs between 1001 to 5000 people, focuses on telecommunication services, and serves clients in more than 25 countries. The company has a department of Analytics composed of several teams of different projects and domains, like the Data Science team. The Data Science team comprises ten people. The PM project was developed within an initiative project under the Project Manager. During the project period, the teamwork provided a foundation for collaboration and communication, crucial to achieve the proposed goals. 5 Chapter 2 Theoretical Framework Theoretical Framework (Chapter 2) explains all the concepts and general information behind each phase of the Project Development (Chapter 3). Moreover, it fulfils the first goal that identifies and understands Data Science concepts and models to solve the PM problem, stated in the previous Chapter 1in Table 1.1. In summary, this Theoretical Framework is organised in four sections; each one is a phase of the CRISP-DM method according to the Figure 1.2 referred in the Introduction Chapter 1, being the following: Data Understanding (Section 2.1) that describes the type of data (in this case Time Series data), and all the concepts to understand the data quality; Data Preparation (Section 2.2) explains the methods to extract the relevant features and some techniques employed for constructing the data to be used on the Survival Analysis (SA) model alike Anomaly Detection models and Statistical Smoothing techniques; Modelling (Section 2.3) that describes the chosen technique to solve the Predictive Maintenance problem (Survival Analysis) and the last Section is Evaluation (Section 2.4) that describes essential metrics to evaluate the performance of the models. 2.1 Data Understanding Data Understanding is the second phase of the CRISP-DM methodology Figure 1.2, a stage for the fundamental data exploration. The book "Data Mining. Concepts and Technique" [10] inspired all the concepts or techniques disclosed in this section. The section starts by identifying the different types of analysis that are important for discovering patterns. Then, it describes the features types for understanding more enhanced the data. Then, this section will evaluate data quality problems managing to explain reasonable conclusions throughout the development. Additionally, at the 7 CHAPTER 2. THEORETICAL FRAMEWORK Type Description Nominal Also named as categorical, represents some kind of category. Not being possible to do mathematical operations. Ordinal The features have an order to rank, but the magnitude between successive value is not known. Boolean It’s a binary feature only with two categories 0 or 1. Numeric Ratio It is a quantitative being the ratio of another value having the point of origin. Interval Is quantitative value being a scale of equal size units ordered. Table 2.1: Table that describes the characteristic of the different type of features stated on [10]. end of this section will focus on a particular type of data that tracks the movement of data points (historical data) applied to the PM problem that is Time Series data. In Data Science, the number of variables/ features used in a study will define the type of analysis. Univariate Analysis utilises only one feature, employing analysis like frequency distribution tables, bar charts, histograms, frequency polygons, and pie charts. Bivariate Analysis examines the relationship between two features, for instance, applying correlation matrix or regression. Finally, Multivariate Analysis represents the relationship between three or more features, for instance, using Cluster Analysis or Principal Components Analysis. Table 2.1 describes the different features that populate a dataset can be composed. The feature type nominal , ordinal , binary or numeric helps to understand the information that belongs to a feature. Table 2.2 describes the meanings within different data quality terms that involve accuracy , completeness , consistency , timeliness , believability and interpretability . The quality of the data is essential because low-quality data leads to low-quality mining results. The data is exposed to noise, missing values and inconsistencies on realworld data because of the typically colossal size and the multiple and heterogeneous sources, as stated by Han, Jiawei Kamber, Micheline Pei, and Jian [10]. 2.1.1 Time Series data Time Series data is a sequence of numeric data points ordered in time. It can be distributed at fixed or random time intervals, like per minute, hour, days or months. Nonetheless, time is an independent variable. This type of data is generated naturally, such as stock markets and technical observations. In real-world applications, Time 8 2.1. DATA UNDERSTANDING Terms Description Accuracy Avoids inaccurate attribute values, human error, equipment malfunction transmitting data, or even missing values; Completeness Avoids the absence of values of interest, perhaps due to unavailability of the data or disregarded historical data; Consistency Avoids incorrect data, essentially naming, formatting input fields or even avoid duplicated data; Timeliness Avoids data being incomplete after or before a certain period; Belivability How much the users trust the data; Interpretability How easy the data is understand. Table 2.2: Table that describes the terms that accomplish the quality of the data stated on [10]. Series analysis is used for detecting trends in financial markets, analysing electricity consumption or even sales forecasting. Time Series analysis focuses on finding different patterns in data according to BBC article [27], "Finding patterns is extremely important. Patterns make our task simpler. Problems are easier to solve when they share patterns because we can use the same problemsolving solution wherever the pattern exists. The more patterns we can find, the easier and quicker our overall task of problem-solving will be". Chatfield [6] states four different patterns to characterise the time series data tin: 1. Trend, T(t): This pattern exists when there is a tendency to increase, decrease, or be static over a long period on a Time Series. For example, the number of houses in Lisbon over time can show an upward trend. 2. Cyclical, C(t) This pattern exists when data shows ups and downs that are not of a fixed period. For example, business cycles can last several years, and it is unknown the length of the cycle. 3. Seasonal, S(t): This pattern exists when a Time Series is influenced by a fixed and known period. For instance, a month, day of the week, parts of the day, the weather season or traditional holidays. For example, online sales increase during Christmas before decreasing again, or electricity consumption is higher during the day and lower during the night. 4. Irregular or random variations, I(t): This pattern exists when there is an unpredictable event, without recurrence. For example, an earthquake, war or anomaly events. 9 CHAPTER 2. THEORETICAL FRAMEWORK Figure 2.2: Representation of the Autoencoder model, the first two layers represent the encoder, the red layer the code and the last two layers represents the decoder. neural network. An illustration of this algorithm is shown in Figure 2.2. This neural network algorithm aims to learn a representation of the data by training the data to copy the input to output (the output and input layer have the same number of nodes) approximating the input data since the model has to learn the essential aspects of the input data and not all its features of the input data being the main goal to minimize the reconstruction error. The architecture of an Autoncoder is composed by three parts as shown in Figure 2.2: 1. Encoder function: h=f(x) = f(Wxhx+bxh). h is the internally hidden layer, also known as code , W is the weight and b the bias; 2. Decoder function that produces the reconstruction: r = g ( h ) = g ( f ( x )) = f ( Whxh + bhx) = x, the output layer; 3. Reconstruction Error (RE): ||x−r||. In summary, the goal of an AE is to map an input x to an output, the reconstruction r , through an internal representation, h . Where the function f maps x to h and the function gmaps hto r. The Autoencoder learns to minimise the RE for Anomaly Detection; this RE value is seen as the anomaly score. Thus data points with a high value of RE are considered anomalies. The following Algorithm 1 summarises how this is applied in Anomaly Detection. Autoencoder initially was created for dimensional reduction and feature selection; now, they are used in Anomaly Detection. One application of AE’s that supports sequence data as input data is Long-Short Memory Term (LSTM)AE, which can learn a compressed representation of temporal data and an internal memory to remember. Typically, this encoder layer’s architecture is an LSTM model that reads the input sequence (that can be of more than one layer). This layer’s output represents the hidden 16 2.3. MODELLING - SURVIVAL ANALYSIS Algorithm 1 AE on Anomaly Detection Init: Anomalous dataset x, threshold α; For i= 1 to N: 1. RE(i) = ||x(i) - g(f(x(i)))||; 2. If RE(i) > α: x(i) anomaly else x(i) not anomaly; end if, end for output: Reconstruction error ||x−r||. layer that is the internal learned representation of the entire input sequence, that can be a repeat_vector of a fixed length. This layer is the input of the LSTM decoder model layer that generates the output sequences. The dropout layers help prevent overfitting (happens when a model learns the detail and noise in the training data). A suggestion of this type of architecture is given on the Keras documentation [21], which is the one used in Project Development (Section 3.3). There are other AE models used in Anomaly Detection, such as the Robust Deep Auto Encoder [31], DONUT [29], or any other state of the art algorithms referred on [30]. 2.3 Modelling - Survival Analysis The modelling phase is the fourth step on the CRISP-DM methodology (Figure 1.2), and it refers to the modelling technique selected to approach the Predictive Maintenance (PM) problem, which is, Survival Analysis (SA). According to the dictionary, to survive is the "act or fact of surviving, especially under adverse or unusual circumstances". Although surviving is a property of living beings, it can be applied to other contexts like things that have beginnings, transformations, and then deaths [17]. In this light, we can talk about the life span of a device or a customer churn (the client abandons the company and moves to the competitor). Survival Analysis (SA) is a collection of statistical techniques that have as the outcome: the time until an event occurs or the length of time until the change of an event’s occurrence. For example, from healthy to sick or from normal behaviour to irregular behaviour. The Survival Analysis technique was previously applied for solving this PM problem [25]. Nonetheless, other techniques could also be used for the same purpose, namely, Logistic Regression. Logistic regression can be applied to estimate the probability of experience a particular event within a limited period. However, it does not consider when the fault event occurred; therefore, it ignores the length of the survival process [17]. There is no supervision on learning the machine learning problem in unsupervised learning, which means that outcomes are not labelled. Supervised learning is the opposite; there is supervision on the learning model where it contains labelled data. 17 CHAPTER 2. THEORETICAL FRAMEWORK Figure 2.3: Types of censored data, extracted from the book written by Kleinbaum and Klein, that are, Right-censored, Left-censored and Interval-censored respectively [15]. Semi-Supervised contains labelled and unlabeled examples used while learning the model. For constructing the data for any SA model, the dataset structure must contain two primary features: The time event process and censoring. In order to understand Survival Analysis’s critical concepts, two use cases will be described referred on [15]. (1) A study that follows leukaemia patients in remission over several weeks to see how long they stay on that status. (2) The duration of patients surviving after receiving a heart transplant. The time event process is the time until the event occurs. On the scope of previous examples: (1) The event is going out of remission, and time is the period in weeks until an individual goes out of remission. (2) The event is death, and time is the period until death. The censoring occurs when there is no knowledge about the survival time, therefore no event. On the scope of the previous examples: (1) The patient’s survival time is censored if the study ends while the patient is still in remission. So at that time, the event did not occur or will happen after the study ends. (2) Censored if the patient did not die when the study ends. A flag typically represents censoring , 1 for the event that happened (not censored) and 0 for the opposite (censored). Furthermore, there are several censoring types, the right, left, and interval censoring, as illustrated in Figure 2.3 retrieve from [15]. •Right-Censored: The right side of Figure 2.3 illustrates a right-censored example. The y-axis is the events A to F, and the x-axis is the event process’s time. At some point in time, some events are still in the study after week 12. So it is unknown how long these events will last. These observations are right-censored, being the events B, C, D and E. So the failure, in this case, will occur after the recorded time. •Left-Censored: The centre of Figure 2.3, regarding a left-censored example, illustrates the follow up of an individual until he becomes HIV positive. In this case, the study ends at time t , and it is known that the individual tested positive. 18 2.3. MODELLING - SURVIVAL ANALYSIS Figure 2.4: Representation of a Survival Curve, that defines the survival function S ( t ) on the y-axis, and time t on the x-axis that starts from 0 to infinity. Figure taken from [15] However, it is unknown exactly when the first exposure to HIV occurred. These cases are named left-censored observations when the failure happened before a particular time and without knowing when. •Interval-Censored: In the left side of Figure 2.3, an HIV interval-censored example is displayed. In this case, it is unknown when the individual was exposed for the first time, but it is known within some time interval. Between his negative HIV test on time t1 and his positive HIV test on time t2 . These observations are interval-censored. So it is known within a period when the failure occurred. To detect the beginning of the time event process (time until the abnormal event) on this project, two approaches were considered Statistical Approach (STA) and Anomaly Detection Approach (AD), already mentioned in the past two Sections 2.2.2 and 2.2.3. The implementation of these techniques will be explained in more detail in the next Chapter 3. Survival Function is also an important concept in SA, denoted by S ( t ) where t is a specific value of interest from a random variable T that is the survival time, with T≥ 0. S ( t ) gives the probability of a random variable T to survive longer than some specified time t, represented by Equation 2.12. S(t) = P(T≥t)=1−P(T≤t) (2.12) The representation of a Survival Curve in Figure 2.4 defines the survival function S ( t ) on the y-axis, and time t is the x-axis goes from 0 to infinity. Accordingly, survival function decreases when t increases, which means at the start of the curve, there is a higher surviving probability on that instance than at the end of the curve, which tends to zero. Notwithstanding, there is no smooth curve in real-world data like Figure 2.4, and the time may not converge to zero. The Hazard Function denoted by h ( t ), gives the instantaneous rate of failure at time t, and is mathematically defined as: h(t) = lim ∆t→0 P(t≤T < t +∆t|T≥t) ∆t(2.13) 19 CHAPTER 2. THEORETICAL FRAMEWORK So h ( t ) represents the hazard rate as the ratio of the conditional probability of experiencing a particular event at time t given the condition T≥t over a small interval of time ∆t. This function gives the opposite information given by the survival function S ( t ), and the formula gives a rate between 0 and infinity. This function is always nonnegative, and the curve does not need to start at value one and go down to zero. Instead, it can start anywhere and go up and down. Consequently, this survival function S ( t ) is more appealing for analysing the survival data, focusing on surviving. The hazard function h ( t ) measures instantaneous potential or can identify a specific model that focuses on failing. There is a relationship between the two functions. From one, it is possible to derive the other one. There are several state-of-the-art models like Kaplan-Meier (KM), Nelson Aalen and Cox Proportional Hazard. Or more complex models like Neural Multi-Task Logistic Regression [25], Random Survival Forest [12], or Linear Support Vector Machines for SA [8]. Although the only one that will be used is Kaplan-Meier (KM). 2.3.1 Kaplan-Meier The Kaplan-Meier (KM) estimator, also known as a product-limit method, is a SA model that calculates the survival function S ( t ). KM is a univariate and non-parametric model used to estimate a Survival Curve of the population, based on the independence between censoring and the real survival times. For a sample of n individuals, there are n survival times until the event; these survival times can be ordered by a rank t1≤t2≤... ≤tn , where ti represents the time at which the individual i experiences an event. Since ti individuals with censored time smaller than ti have already exited, the remaining survivors are exposed to the risk event at time ti , the ni . On KM, the term tied observation time refers to the existence of many events to rank, and some subjects may share the same survival time. The following Equation 2.14 is the survival function estimator that gives the probability of living longer than t. b S=Y i:ti≤t 1−di ni!(2.14) The variable di represents the number of events at the time ti , considering the tied observations and nibeing the population at risk just before ti. Furthermore, it is possible to find the 95% Confidence Intervals with the following Equation 2.15 that gives the variance of an estimated KM survival probability. b SKM(t)±1.96qV ar hb SKM(t)i(2.15) The V ar hb SKM(t)i denotes the variance of KM survival estimate at time t , the most common approach to calculate this variance is according with Greenwood’s formula: 20 2.4. EVALUATION V ar hb SKM(t)i=b SKM(t)2X f:t(f)≤t"mf nf(nf−mf)#(2.16) Where t(f) is the f-ordered failure time, mf is the number of failures at t(f) and nf is the number in the risk set at t(f). Kaplan-Meier (KM) is a state of the art model of SA. However, it is mainly descriptive; it only uses one variable. On the other hand, it describes a Survival Curve, it compares two study populations, it is intuitive, and it is a low complex model according to X. Liu [17]. 2.4 Evaluation The evaluation phase evaluates and understands how well the model performed to achieve the third goal from Table 1.1. A metric to evaluate and compare the Survival Curves obtained by the KM estimator is the Log-Rank Test. The Log-Rank Test is suitable for non-parametric models alike KM. This test deals with Right-Censored problems, evaluating if the Survival Curve of two or more groups is statistically equivalent distributed. The summary of this test is displayed in Equation 2.17. H0: No difference between Survival Curves. Log-Rank statistic ∼χ2with G - 1 df under H0 (2.17) The test statistic is approximately a chi-square ( χ2 ) in large samples with G-1 degrees of freedom (df), where G denotes the number of groups being compared. Under the null hypothesis, H0 if there is no overall difference between the Survival Curves, under this H0 the log-rank is approximately chi-squared with one degree of freedom, the p-value is determined from the chi-squared distribution tables. Other alternative tests used for evaluating the Survival Curves are Wilcoxon, Tarone-Ware, Peto and Flemington-Harrington [17]. With features and censoring , it is possible to evaluate the survival performance using the test set (data that is not used for fitting the model) to calculate some known metrics referred on Table 2.3 taken from the book [10]. This Table 2.3 mentions four important terms that are normally represented on a confusion matrix (visualization tool) and are used to calculated each one of the metrics shown on the Table 2.3, and can be defined as follow: •True Positive (TP): The number of predictions classify as positive that were correctly classified; •True Negative (TN): The number of predictions classify as negative that were correctly classified; 21 CHAPTER 2. THEORETICAL FRAMEWORK Measure Formula True Positive Rate (TPR) T P T P +FN False Negative Rate (FNR) FN FN +T P = 1 −T P R True Negative Rate (TNR) T N T N +FP False Positive Rate (FPR) FP FP +T N = 1 −T NR Table 2.3: Evaluation metrics where TP, TN, FP, P, N refer to the number of true positive, true negative, false positive, positive, and negative samples, respectively. Adapted from "Data Mining. Concepts and Technique" [10]. •False Positive (FP): The number of negative predictions mislabeled classify as positive; •False Negative (FN): Finally, the number of positive predictions mislabeled classify as negative. The metrics from Table 2.3 help understanding if a model is well predicted according to real labels. 22 Chapter 3 Project Development ´ As stated in the Introduction Chapter 1, the main problem is to develop the first Predictive Maintenance application within the company. At this stage, the first goal from Table 1.1 is depicted on Theoretical Framework Chapter 2, which answered the question "How to do it?". Consequently, the second goal applies the aforementioned techniques to reduce at least 70% of the emergency interventions on the Set-Top Box with maximum anticipation. Moreover, this chapter will also include the third goal’s outcomes by demonstrating the achieved solution through a dashboard. According to the previous chapters, the project is divided into six stages, alike CRISP-DM methodology. Therefore each section of this Chapter 3will describe the phases between 2 and 5. Respectively, the Data Understanding in Section 3.1, the Data Preparation in Section 3.2, the Data Modelling and Evaluation in Section 3.3 and finally Deployment in Section 3.4. Considering that the project duration was between March and June of 2020, the different phases were distributed along the timeline. Figure 3.1 illustrates the expected timeline (blue shade) distributed within the different phases alongside the respective duration, compared with the real timeline (yellow shade). By relating the two timelines, a delay between both is apparent. Because the company integrates a real-world industry, it is unlikely to predict sudden situations; for instance, there was one week of delay at the beginning of the project since the company did not have the data available to start the data analysis. Besides, in June, there was another goal proposed (that is explained on the last Section 3.4 Deployment), so the delivery was extended until the end of July, a three weeks delay. However, some other constraints could also delay the project, such as data confidentiality, the data set’s size, 23 CHAPTER 3. PROJECT DEVELOPMENT Figure 3.1: The project timeline with the expected and the real time represented in weeks. and the low computing resources. In the last chapter of this report, these problems are described in more detail. The project aligned to the project duration was developed in the Pycharm IDE (an integrated development environment used in computer programming), employing the well known Python language open-source, easy to implement and gives the possibility of being creative. For this project pipeline, which is discussed in more detail in Appendix A, the main Python tools used were: • Pandas and Numpy for Data Manipulation; • Scikit-Learn for Machine Learning concepts, feature selection, and preprocessing; • Keras for Deep Learning model; • PySurvival for SA; • Dash, Matplotlib and Seaborn for Visualization. Finally, for saving the several versions of the project, it was used GIT, which is a version control system that tracks and records all the decisions made along with the project development. GIT also allows reverting to previous specific versions. 3.1 Data Understanding Data Understanding is the second stage of the workflow in Figure 3.1, being one of the most prominent. This section is divided into Data Description (Section 3.1.1) and 24 3.1. DATA UNDERSTANDING Short Name Feature Name Description Data Type Feature Type Active Active Device It is true if the device is active at the data extraction time. Integer Boolean Active Date Latest Active device date The last record date when the device was active. Datetime Interval AMUSE App Memory Usage Last registered record of memory usage from the app in megabytes. Integer Interval BN Brand Name The brand of the device. Object Nominal CPULV CPU Percentage Level Last registered device’s CPU percentage. Integer Ratio CPUTp CPU Temperature Last registered device’s temperature level in celsius. Integer Interval Device Device ID Device identification. Integer Nominal DMFRE Device memory free Last registered device’s memory available. Integer Interval DMUSE Device memory used Last registered device’s memory usage. Integer Interval Household Household ID Client Identification with at least one device. Integer Nominal HW Hardware Version Last registered device’s hardware version. Object Ordinal MN Model Name The name of the model device. Object Nominal PSmode Power Saving Mode Power saving mode configured on device. Object Nominal STBmode STB Mode Actual STB mode. Object Nominal SW Software Version Last registered device software version. Object Nominal Time Timestamp The timestamp the information of the box is received. Datetime Interval Table 3.1: Description of the features of the initial dataset, as well as the type of data and feature. Data Exploration (Section 3.1.2). The first goes through collecting and describing the initial data, and the second explores important findings or patterns. Due to the IoT technologies, various sensors on the Set-Top Box generate data sent to a data centre, so it is possible to obtain information about the hardware and software components. Therefore, the extracted subset originates from this information. As an essential remark, since we are dealing with operational data, it was necessary to declare the data’s privacy by masking the real values with percentage values. The principal demand for this project was to obtain all the historical data of the equipments. Unluckily, the data centre did not have the information starting from the device’s first event. It was only possible to have data between August 2019 and March 2020, which comprises eight months of historical data. The following demand implied the extraction of features; concerning that, it was necessary to discuss with the business specialists to understand the most impacted features to prevent faults in STBs. Hence, the selected features extracted from the data centre were the hardware features since the machine elements are essential to determine the STB lifetime. Due to the project’s dimension and limited resources, the extracted data only contains a few variables concerning equipment’s information. 3.1.1 Data Description The collected data resulted on Table 3.1, that includes the Short Name referred to the Feature Name and the respective Description . Additionally, the columns Data Type and Feature Type describes extra information about the features (concepts detailed earlier in Table 2.1). 25 CHAPTER 3. PROJECT DEVELOPMENT Process Name Description How much? Data Quality Duplicate rows Remove rows that are exactly the same. 0.02% of all dataset Consistency Change features format Change the format of the features for datetime, float or int. All features Consistency Remove noisy data Remove noisy words, e.g. ’undefined’ or strange symbols, e.g. ’%’ or lowercase. All features Consistency Missing values by feature Remove features that have a high % of missing values. No features Accuracy Constant features Remove the features with no variance (constant). BN Consistency High correlated numerical features Remove high correlated numerical features, erasing the ones that own the same knowledge employing Pearson Coefficient (equation 2.2). DMUSE Interpretability High correlated categorical features Remove high correlated categorical features, this involves erasing the ones that own a strong association employing Cramér’s V Coefficient (equation 2.1). MN Interpretability Table 3.2: Data Cleaning report with all the data transformations applied to the features, including the data quality report based on the concepts from Table 2.2. Data Preparation will branch into two steps: Data Cleaning 3.2.1 and Data Construction 3.2.2. On the first step, all the cleaning transformation steps are reported, and on the second step is the transformation of the cleaned data on the final structure to be used on the SA model. 3.2.1 Data Cleaning The data cleaning process is an essential step for the subsequent steps. All the decisions here can determine the final results. The cleaning processes are divided into two tables. On both tables Process column identifies the performed transformation. The second column Description describes the transformation process. The third column How much? relates the impact on the dataset of doing that transformation, for instance, the percentage of removed devices or the number of removed features. Finally, the column Data Quality indicates the 32 3.2. DATA PREPARATION Process Name Description How much? Data Quality Filter devices Remove equipments that are not STB.No devices Consistency Missing values by household For each client, if there is a high % of missing values in the respective CPUTp feature, the device is deleted; Otherwise, the imputation is done, in this case using Median and MAD. 3% devices Accuracy Low historical data by device The equipments with a significant small historical timeline compared to the others were removed. 22% devices Timeliness Low number of events by device The equipments that have a significant small number of events comparing to the others, were deleted. 25% devices Completeness Table 3.3: Data Cleaning report for removing the inconsistent devices, including the data quality report based on the concepts from Table 2.2. data quality term that is succeeded by that data cleaning process. The definitions of such concepts were explained earlier in Table 2.2. Table 3.2 describes the processes applied to the features by removing all the noisy data, missing values, inconsistencies and feature selection transformations. Moreover, Table 3.3 describes the processes applied as criteria for deleting inconsistent devices. Both tables guarantee the quality of data despite having a significant reduction of 50% of the devices—ending up to be the decision performed to have a consistent dataset. However, this reduction leads to less time series to analyse, consequently, fewer devices. At this point, the dataset is composed of 52% active devices and 48% inactive devices, being a balanced dataset (the two groups have almost the same weight). After the transformation process, only the features Device,Time,Active, and CPUTp are used to determine the input data for the model phase that will be described in the next Data Construction Section 3.2.2. It was only considered CPUTp because, as previously concluded, it is a good indicator for the device malfunction, and due to the limited amount of time constraints, only a univariate model will be applied. However, Table 3.2 mentions all the transformations made for all the features (since all can be used in future work for multivariate analysis). 33 CHAPTER 3. PROJECT DEVELOPMENT Figure 3.7: Process of constructing the final data set for the model with all the important columns event,end date,start date,time event process and feature. 3.2.2 Data Construction The next step is constructing the dataset used as input on the Model phase (Section 3.3). As previously explained in Section 2.3, the Survival Analysis depends on two mandatory features regarding each device censorship and the time event process. The time event process is the number of days from the beginning of the anomalous event until the fault event occurred (device breakdown). Moreover, the censoring is a Right-Censoring problem, where the device is censored if it never encountered an event until the data extraction day (active devices). It is unknown if any event happened after the extraction day. All the phases to accomplish this final dataset is summed in the flow Figure 3.7. The primary step implies creating a column event , signed with value one if the event did occur. Alternatively, it is signed with a value of zero if censored. This feature is based on the Active feature, which implies being censored if active at the data extraction moment. The following step is to create a column end date , which is the date of the last registered event from each device, obtained by the column Time. The third step is creating a column start date , the estimation regarding the timestamp or date that the device begins to malfunction (the event of interest). The main challenge is to establish this event since it is unknown when the device begins to break. So two different paths were adopted to identify this start date: 1. For the censored devices (active devices), the start date is fixed as the first date recorded by the device, acquired from the column Time. 2. For devices not censored (inactive devices), the start date implies a prediction employing a Statistical Approach or the use of Anomaly Detection Approach. The Statistical Approach is based on the results of the exploratory analysis described during the last Section 3.1.2 that proved CPUTp feature implied to be decisive towards device failure. 34 3.2. DATA PREPARATION Figure 3.8: Line plot with time against CPUTp that compares the behaviour of a device with grey shadow and the effect of applying EMA technique with different lags represented by the remaining colours. Figure 3.9: Line plot with time against CPUTp that compares the behaviour of a device with grey shadow and the effect of applying SMA technique with different lags represented by the remaining colours. The statistical technique is used as a simpler model for selecting the start date by employing one of two distinct Moving Average techniques EMA and SMA that were covered earlier in Section 2.1.1. Each model application employs a sliding window to compute the average over a period collection of ndays. The event’s start date using these techniques will be the first occurrence reaching a specific temperature. The respective application of EMA and SMA is represented by Figure 3.8 and 35 CHAPTER 3. PROJECT DEVELOPMENT Figure 3.10: Process of getting the start date by means of Anomaly Detection Approachmodels, with input the time series and the output the start date. Figure 3.9 for the example of an inactive device. Both plots represent on the x-axis the Time and on y-axis the CPUTp. The grey line represents the raw time-series of the inactive device. The black line represents the temperature threshold based on the conclusions previously explained (Section 3.1.2), where the temperature in the inactive devices reaches more than 60 degrees. The remaining colours represent the application of each technique for different ndays. When comparing both figures, the SMA is smoother than the EMA approach since it filters the effect of random variations. Whereas EMA with different lags, it does not differentiate much from the real behaviour, which does not outline the abnormal patterns; this probably happens because EMA gives more weight to the most recent data points. Therefore, it is plausible to conclude that SMA removes better the noise, and it is the most suitable technique for detecting the start date of the Statistical Approach. SMA technique will be employed in the modelling phase, using different temperature thresholds to understand which one yields better results. The chosen lag for SMA will be one day since it can show slightly more variation when compared with other lags, as seen in Figure 3.9. These analyses for EMA and SMA were based on all inactive devices. On the other hand Anomaly Detection Approach (AD) uses a more complex model for detecting the start date of the event using only the CPUTp feature, the models can be: AE ,RPCA,SR,IF or MAD already explained on Section 2.2.3. As opposed to the Statistical Approach that the start date is obtained without any model learning. All the models need to go through different steps from the time series representation until they reach the start date . A precise idea of this process is designed in the Diagram 3.10. Each step can be slightly different from this diagram depending on the implemented model, except for Step 1 and Step 5. On the Step 1 , data is divided into two data sets, the train and the test set. The first receives the devices that hold normal behaviour (active devices), and the latter receives the devices that hold abnormal behaviour (inactive devices). The split acts in this direction since it is essential to train the models among "normal" pattern devices and test among inactive devices to identify the 36 3.2. DATA PREPARATION Table 3.4: Comparison of the models used to calculate the start date Event, such as Autoencoder (AE), Robust Principal Component Analysis (RPCA), Spectral Residual (SR), Isolation Forest (IF) and Median Absolute Deviation (MAD). abnormal pattern. On the Step 5 , it is the transformation of the scores (outcome from Step 4) towards the start date of the event for each device by following the subsequent process: 1. A threshold for the anomalies scores, it is an empirical metric; 2. If a score of the time series is above the threshold, it is an anomaly; 3. For each point a cumulative sum of scores among a window of ndays is delivered, it was considered a window of 5 days; 37 CHAPTER 3. PROJECT DEVELOPMENT Identification Event End Date Start Date Time Event Process A 0 2020-03-15 23:44:27 2019-08-13 20:26:45 215 B 0 2020-03-15 23:29:27 2019-08-28 10:50:29 200 C 0 2020-03-15 23:30:23 2019-08-03 15:20:48 225 D 0 2020-03-15 23:37:45 2019-08-06 19:38:24 222 E 1 2019-11-07 11:23:07 2019-09-08 11:21:22 60 Table 3.5: An example of the structure of data used as input of the Survival model, including the mandatory features the time event process (in days) and event (censoring). 4. The respective date of the highest cumulative score minus the ndays is considered the start date of that time series, implying the interval with the highest anomaly scores. The Step 2, 3 and 4 , they may depend on the adopted model, are summarised in the first three columns represented in Table 3.4. The column Step 2: Transform data for model describes the transformation made to the data as input for the model. The Step 3: Apply model shows all the parameters used and the respective value. Finally, the Step 4: Calculate Anomaly score explains how the anomaly score was given. Concerning models implementation, each row of the Table 3.4 suggests the following models RPCA,SR and MAD were applied using a package developed by the company’s Data Science team. The IF model used the scikit-learn package. Moreover, the chosen AE architecture was a LSTM AE based on Keras documentation [21]. As it was mentioned in Section 2.2.3, the model parameters (Table 3.4) on Step 3, were retrieved from the literature. When running the models, the AE required a more amount of data and a meaningful computational effort in time and memory compared with the remaining models. The columns Anomaly Threshold , Anomaly general behaviour and plot for one time series , characterise the behaviour of the anomalies regarding each model. Those irregularities are limited by a threshold that classifies if a point is an anomaly ( Anomaly Threshold ). The remaining two columns ( Anomaly general behaviour and plot for one time series ) describes each model’s overall behaviour, including an example of a device covered with anomalies (illustrated with a red dot) detected by each model. However, it is challenging to conclude the most reliable AD model to detect the start date . The model selection would require parameter tuning and optimisation, which were used the default parameters without tuning from this work. The absolute difference between the start date and end date columns originates the fourth step on the flow 3.7 that is the time event process column. The fifth step, feature column adds the CPUTp feature since it is the feature that distinguishes the 38 3.3. DATA MODELLING AND EVALUATION device’s behaviour for future tractability. Finally, the dataset is constructed and ready to be used on the model phase, as displayed in Table 3.5. 3.3 Data Modelling and Evaluation This section is the data modelling and evaluation phase, stage four and five, based on the workflow in Figure 3.1. This section addresses the second goal from Table 1.1, of obtaining an acceptable anticipation period for at least 70% of the urgent interventions for the tech team to intervene in the client’s house. At this stage, the data was carefully assembled as displayed in Table 3.5 and it is ready for modelling. The data was split between two datasets, the train set and test set with 80 % and 20%. The model uses the firs to estimate an optimal anticipation period, and the latter helps to evaluate the model. As previously explained, due to a limit amount of time, it was only applied one SA univariate model, Kaplan-Meier (KM), based on the apriori knowledge acquired in Section 2.3. With the time event process , it is possible to estimate a Survival Curve using the Kaplan-Meier model, which gives the probability of each device surviving longer at each time. This Survival Curve was done for the several datasets that use each start date approach defined in the last section. Such as a more complicated approach using Anomaly Detection Approach models alike AE,SR,IF,MAD and RPCA. Alternatively, a more straightforward approach using the SMA technique employing a CPUTp threshold by reaching 50, 55 or 60 degrees in an average of 1 day (SMA _ 50 _ 1,SMA _ 55 _ 1, SMA_60_1). Figure 3.11 represents the Survival Curve comparison employing multiple data construction techniques presented with distinct shadows, with the time on days against the probability of surviving at that time. Observing the plot is plausible to verify that the two approaches behave in two distinct forms. The AD models start to decrease earlier than the SMA Survival Curves when using the different temperature thresholds. In the Statistical Approach, the probability of surviving above 99% is held for a more extended period so the technician would have more time to assist the client’s house. Whereas AD starts to decrease with a shorter lag, suggesting the technician would have less time to intervene before the failure. To reinforce the above conclusion, the time event process (y-axis) calculated with each model (x-axis) is displayed in Figure 3.12 in a parallel box-plot. The box-plots of the Statistical Approach’s SMA _ 50 _ 1,SMA _ 55 _ 1and SMA _ 60 _ 1, the first quantile starts around 50 days later than the AD models. The Log-Rank Test explained earlier in Section 2.3.1 proofs this conclusion. The test was performed to compare the different curves between the different approaches. 39 CHAPTER 3. PROJECT DEVELOPMENT Figure 3.11: A multiple Survival Curve comparison employing the Kaplan-Meier Estimator with the use of the AD and Statistical Approach models for detecting the start date event. Figure 3.12: Parallel box-plot representing the distribution of time event process for the inactive devices for the different data construction models. The results suggested that within the AD Survival Curves, the test did not reject the null hypothesis with a level of significance of 5%, which means that the curves are similar. The same happened within the Statistical Approach Survival Curves. However, when doing the test between curves from different approaches, the opposite occurred, which means the curves have distinct behaviours. The Survival Curves being different within approaches can be because of: The Anomaly Detection Approach detects the start of the anomalous event as the beginning of the window with the highest number of anomalies. Contrary to the Statistical 40 3.3. DATA MODELLING AND EVALUATION Start event date model Interval TPR FPR TNR FNR SMA_50_1 [38; 227] 71 % 0 % 100 % 29 % SMA_55_1 [36; 227] 67 % 0 % 100 % 33 % SMA_60_1 [29; 227] 67 % 0 % 100 % 33 % Table 3.6: Results of employing the SMA for different temperature threshold for detecting the start of the anomalous event, indicating the final interval, True Positive Rate (TPR), False Positive Rate (FPR), True Negative Rate (TNR) and False Negative Rate (FNR). Approach, which considers as the start date , the first day where the temperature reached the threshold. The second fact is that the AD models did not suffer any optimisation. Finally, only a tiny sample of data was used. Thus, if any of these facts were addressed, the AD Survival Curves could present different behaviours. The final results were analysed only for the Statistical Approach reaching temperatures of 50, 55, and 60 degrees since it yield consistently better. Moreover, the company stated its preference toward a lower complex model as a starting point. Table 3.6 illustrates all the results for each one of the SMA thresholds. The column Interval indicates the interval determined by using the estimations from the Survival Curve employing the Train set. Based on this interval, the proportion of true positives, false positives, true negatives and false negatives that are calculated for the test set are represented on the last four columns on the Table 3.6 respectively: •True Positives Rate (TPR) is the percentage of inactive devices, within the interval, classified correctly; •False Positives Rate (FPR) is the percentage of active devices that already failed before the beginning of the anticipation period (lower boundary). In other words, the active devices that encounter the fault event (reaching a certain temperature) but did not fail; •True Negative Rate (TNR) is the percentage of active devices within the interval classified correctly; •False Negative Rate (FNR) is the percentage of inactive devices that failed before the anticipation period (lower boundary) and did not encounter the fault event, that is, reaching high temperatures. With these metrics, it is reasonable to compare all Statistical Approaches from Table 3.6 and conjure the best approach concerning the company’s main goals. The FNR and the TPR are the only columns with different scores. The FNR can suggest that devices’ failure can be caused by other problems besides overheating since it gives 41 CHAPTER 4. CONCLUSIONS approaches to construct data as input of the Kaplan-Meier (KM) model could be decisive for the final results. With the employment of SMA it was achieved the proposed goal of anticipating 70% of the urgent interventions. Besides model selection, several temperature thresholds were tested in SMA to understand their impact on the results. Thus our final proposal allowed for minimum anticipation of 38 days when devices achieve temperatures of 50 degrees in a one-day smooth average. Finally, in Section 3.4, the third goal, which consists of answer the question "How to demonstrate it?" by applying a dashboard employing the Data Visualization tools that demonstrate the proposed problem’s results. As an extra milestone, a software package was developed with the pipeline used on the project but for different use cases of Predictive Maintenance stated in Section 3.4. Later on, this package was registered on Associação Portuguesa Software (ASSOFT) framework with the possibility of being improved to use in internal and outsourcing projects within the company. Lastly, all these accomplishments provided the ability to proceed to the subsequent stage consisting of a successful demonstration of this solution using the developed dashboard to a future project client with the exact use-case as in this report, with the possibility of employing the developed package. So it enabled the opportunity to go from an initiative project to a long-term project with access to real-time operational data in a more considerable team and access to more resources. 4.1 Report Evaluation and Lessons Learned The initially proposed goals were accomplished until the end of the project time; yet, each goal’s solution changed a lot during that period. The following lessons were learnt along the way: 1. Adaptation to the circumstances without delusions – Since the data was scarce (with only one relevant feature), and the time was short, the initial thought of a multivariate Survival Analysis was changed to a univariate Survival Analysis. This decision allowed us to invest time in visualisation tools to present the project to future clients, leading to the second lesson learnt. 2. Importance of visualisation and adequately conveying the message – it was initially thought only to display the Survival Curve and the respective metrics. However, it ended up being a more complex dashboard that calculated at realtime the final Survival Curve with the final maintenance interval depending on the chosen approach. This change was made because future clients do not know the models or concepts most of the time. Thus, it is essential to demystify the solution through visualisation. Consequently, if the client sees it as a good investment, there is a possibility of obtaining more resources by accessing a more significant project in the future. 48 4.2. LIMITATIONS 3. Investing time smartly and have the flexibility to change the initial plans – Overall, this project was a time to gain the "know-how" since the academic world is quite different from the business world. More time was spent on some project phases than others, which was not expected. As an example, the Data Visualization phase was a step that required considerable time that was initially unplanned. So the following important question emerged: How to invest the time? It can be invested in a low complex model and the structure for future developments or a more complex model without data visualisation and difficult reproducibility. 4. Personal growth and acceptance of mistakes - In conclusion, the organisation skills, time management, team spirit (even more in this Pandemic year, in order to continue to have motivation and support), the desire to learn and learn from mistakes are all critical aspects for continuous learning and self-improvement for those who start and want to continue working in the business world. 4.2 Limitations As stated before, this project could have been solved in several different ways, but since this is a company project, a simpler approach like Statistical Approach works for the wanted results. During the project process, several limitations were found as described along with the report: 1. The project period was planned to be between March and June, but took one extra month due to the fourth milestone and all the following enumerated limitations, as shown in Chapter 3; 2. Lack of data. A small sample size of devices was considered, and due to poor data quality (e.g. the gaps in the historical data), a significant number of devices was deleted as shown in Section 3.2.1, leading to a smaller dataset; 3. There was a lack of historical data from the equipments. Only eight months was considered, as explained in Section 3.1.1; 4. Finally, the lack of validation of the problems that originated the devices swaps; 4.3 Future Work This project has a lot to pick up and improve, as stated along with Project Development (Chapter 3). There are six new suggestions for future work: 1. Get more real-time data with more than eight months of historical data in order to obtain more trustful and accurate results; 49 CHAPTER 4. CONCLUSIONS 2. Optimise the Anomaly Detection Approach models by tuning the parameters, for instance, using the Grid-Search (consider all parameter combinations) or employing a different architecture for the AE model; 3. Optimise the process of anomaly identification in order to avoid the use of the threshold to define the anomaly; 4. Application multivariate SA, such as Cox Proportional-Hazards model, Neural Multi-Task Logistic Regression, Random Survival Forest or others that can be found already implemented in the pysurvival package; 5. Consider joining the two approaches the Statistical Approach and the Anomaly Detection Approach, by using the smoothed curve as an input of the AD models; 6. Finally, have more available resources as team members and computational memory. 50 Bibliography [1] Anacom - Compensation for non-compliance. 2010. url: https://www.anacom. pt/render.jsp?categoryId=339736 (visited on 11/20/2020). [2] Anacom - Supervision of interventions (urgent and non-urgent) and of interventions. 2011. url: https://www.anacom.pt/render.jsp?categoryId=339641 (visited on 11/20/2020). [4] E. J. Candes, X. Li, Y. Ma, and J. Wright. Robust Principal Component Analysis? Tech. rep. 2009. [0] V. Chandola, A. Banerjee, and V. Kumar. Anomaly Detection: A Survey. Tech. rep. 2007. [20] P. Chapman. Step-by-step data mining guide. Tech. rep. 2000. [6] C. Chatfield. Problem Solving: A statistician’s guide. Paperback, 1995. [30] Z. Chunkai and Y. Chen. Time Series Anomaly Detection with Variational Autoencoders. 2019. [7] Cookiecutter Data Science.url: https://drivendata.github.io/cookiecutterdata-science/ (visited on 11/20/2020). [13] J. Crawshaw. AI/ML for CSP Operations: From Reactive to Predictive Autonomous. Tech. rep. 2019. [18] Z. Ding and M. Fei. “An anomaly detection approach based on isolation forest algorithm for streaming data using sliding window.” In: vol. 3. Part 1. IFAC Secretariat, 2013, pp. 12–17. [19] A. Fabrizi. Network equipment failure predictionf.url: https://www.linkedin. com / pulse / network - equipment - failure - prediction - andrea - fabrizi/ (visited on 02/28/2020). [9] I. Goodfellow, Y. Bengio, and A. Courville. Deep Learning. MIT Press, 2016. [10] J. Han, M. Kamber, and J. Pei. Data Mining. Concepts and Techniques, 3rd Edition. Tech. rep. 2011, pp. 40–99; 364–373. [12] H. Ishwaran, U. B. Kogalur, E. H. Blackstone, and M. S. Lauer. “Random Survival Forest.” In: The Annals of Applied Statistics 2.3 (2008), pp. 841–860. 51 BIBLIOGRAPHY [14] W. Jeffrey, C. Chris, M. Elijah, and V. Shankar. RAD — Outlier Detection on Big Data. 2015. url: http://techblog.netflix.com/2015/02/rad-outlier- detection-on-big-data.html (visited on 02/24/2020). [15] D. G. Kleinbaum and M. Klein. Survival Analysis. Springer-Verlag New York, 2012. [16] C. Leys, C. Ley, O. Klein, P. Bernard, and L. Licata. “Detecting outliers: Do not use standard deviation around the mean, use absolute deviation around the median.” In: Journal of Experimental Social Psychology 49 (2013), pp. 764–766. [24] F. T. Liu, K. Ting, and Z. - H. Zhou. “Isolation Forest.” In: Jan. 2009, pp. 413 –422. [17] X. Liu. Survival Analysis: Models and Applications. Higher Education Press, 2012. [22] Plotly. Dash for Python Documentation.url: https : / / dash . plotly . com / introduction. [8] S. Pölsterl, N. Navab, and A. Katouzian. Fast training of support vector machines for survival analysis. Tech. rep. 2015, pp. 243–259. [3] Reclamações no sector das comunicações Primeiro Semestre de 2020. Tech. rep. 2020, pp. 18–21. [23] H. Ren, B. Xu, Y. Wang, C. Yi, C. Huang, X. Kou, T. Xing, M. Yang, J. Tong, and Q. Zhang. “Time-Series Anomaly Detection Service at Microsoft.” In: Proceedings of the ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (2019), pp. 3009–3017. [0] SAS Help Center: Introduction to SEMMA. 2017. url: https://documentation. sas.com/?docsetId=emref&docsetTarget=n061bzurmej4j3n1jnj8bbjjm1a2. htm&docsetVersion=14.3&locale=en (visited on 11/20/2020). [21] P. Vijay. Timeseries anomaly detection using an Autoencoder. 2020. url: https:// keras.io/examples/timeseries/timeseries_anomaly_detection/ (visited on 01/09/2021). [25] J. Wang, C. Li, S. Han, S. Sarkar, and X. Zhou. “Predictive maintenance based on event-log analysis: A case study.” In: IBM Journal of Research and Development 61 (2017), pp. 121–132. [27] Why do we need to look for patterns? - Pattern recognition.url: https://www.bbc. co.uk/bitesize/guides/zxxbgk7/revision/2 (visited on 07/25/2020). [28] Why Is Predictive Maintenance Important? - Digital Doughnut. [29] H. Xu, Y. Feng, J. Chen, Z. Wang, H. Qiao, W. Chen, N. Zhao, Z. Li, J. Bu, Z. Li, and et al. “Unsupervised Anomaly Detection via Variational Auto-Encoder for Seasonal KPIs in Web Applications.” In: Proceedings of the 2018 World Wide Web Conference on World Wide Web - WWW ’18 (2018). 52 BIBLIOGRAPHY [31] C. Zhou and R. C. Paffenroth. “Anomaly Detection with Robust Deep Autoencoders.” In: Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining. Association for Computing Machinery, 2017, 665–674. [32] Z. Zhou, X. Li, J. Wright, E. Candes, and Y. Ma. “Stable Principal Component Pursuit.” In: IEEE International Symposium on Information Theory - Proceedings (2010), pp. 1518–1522. 53 Appendix A Appendix 1 On the middle of July 2020, the dashboard visualization was concluded. It emerged a new opportunity, to develop a software package with the pipeline used on this project but for different Predictive Maintenance cases. Consequently, this is another proposed milestone by the company, therefore the goals Table 1.1 was updated by adding this new opportunity. This extra milestone was successfully done until the end of July. This aims to be more generic, thus only the Data Construction, Modelling and Evaluation phases were implemented. Since the Data Cleaning phase will depend on the nature of the dataset or the use case. Later on, it was registered this generic package on the Associação Portuguesa Software (ASSOFT) framework records the author rights on the software to gain intellectual protection and gain more value in the company. This achievement was another success story that can be employed on different use case projects within internal and outsourcing company projects, not only for the one described in this report. The package followed the cookiecutter structure template developed by GitHub [7] and a representation of the pipeline flow is displayed in the Figure A.1, and follows the subsequent steps: 1. Import data already cleaned with the following input columns: timestamp,identifier,event and feature_1 (alike the input shown on Section 3.2.2) and split between train and test set; 2. Construct the data as input of the model phase, that follows all the steps described earlier on Section 3.2.2, however, is necessary to choose the approach in order to estimate start date event that can be an Anomaly Detection model or 55 APPENDIX A. APPENDIX 1 Figure A.1: A flow that represents the architecture of the package pipeline that followed the cookiecutter structure template developed by GitHub [7]. Statistical model - the definition of the respective parameters can be defined on a separate script; 3. Apply the Survival Analysis model with the output of the Construct Data (previous step) using the train set. The import model has Kaplan Meier as the only option described in Section 3.3; 4. Return the Survival Curve and the corresponding estimations for each identifier of the test set following the same strategy as described on the section 3.3; 5. Lastly, if there is a need, the dashboard can be displayed, similar to the one described in the last Section 3.4. Each square step of the flow in Figure A.1 corresponds to a python script, and the folder structure is referenced in Figure A.2. Later on, it was registered this generic package on the Associação Portuguesa Software (ASSOFT) framework records the author rights on the software to gain intellectual protection and gain more value in the company. This achievement was another success story that can be employed on different use case projects within internal and outsourcing company projects, not only for the one described in this report. 56 Figure A.2: The structure of the package pipeline that followed the cookiecutter structure. 57