Predictive analysis on Multivariate, Time Series datasets using Shapelets

Similar documents
Learning Time-Series Shapelets

Clustering. Professor Ameet Talwalkar. Professor Ameet Talwalkar CS260 Machine Learning Algorithms March 8, / 26

Machine Learning Basics

Applied Machine Learning Lecture 5: Linear classifiers, continued. Richard Johansson

Mark your answers ON THE EXAM ITSELF. If you are not sure of your answer you may wish to provide a brief explanation.

Style-aware Mid-level Representation for Discovering Visual Connections in Space and Time

Midterm exam CS 189/289, Fall 2015

CSE 417T: Introduction to Machine Learning. Lecture 11: Review. Henry Chai 10/02/18

CSE 417T: Introduction to Machine Learning. Final Review. Henry Chai 12/4/18

From Binary to Multiclass Classification. CS 6961: Structured Prediction Spring 2018

Logistic Regression. COMP 527 Danushka Bollegala

Machine learning comes from Bayesian decision theory in statistics. There we want to minimize the expected value of the loss function.

Apprentissage, réseaux de neurones et modèles graphiques (RCP209) Neural Networks and Deep Learning

ECE521 Lectures 9 Fully Connected Neural Networks

Midterm: CS 6375 Spring 2015 Solutions

Linear Classification. CSE 6363 Machine Learning Vassilis Athitsos Computer Science and Engineering Department University of Texas at Arlington

Machine Learning Basics: Maximum Likelihood Estimation

COMPUTATIONAL INTELLIGENCE (INTRODUCTION TO MACHINE LEARNING) SS16

Machine Learning Basics Lecture 3: Perceptron. Princeton University COS 495 Instructor: Yingyu Liang

Lecture 14 : Online Learning, Stochastic Gradient Descent, Perceptron

Least Mean Squares Regression. Machine Learning Fall 2018

Real Estate Price Prediction with Regression and Classification CS 229 Autumn 2016 Project Final Report

Online Learning and Sequential Decision Making

Linear Regression. S. Sumitra

Least Mean Squares Regression

CS260: Machine Learning Algorithms

Midterm. Introduction to Machine Learning. CS 189 Spring Please do not open the exam before you are instructed to do so.

ECS171: Machine Learning

Logistic Regression Trained with Different Loss Functions. Discussion

Modeling Data with Linear Combinations of Basis Functions. Read Chapter 3 in the text by Bishop

ECE 5984: Introduction to Machine Learning

Linear discriminant functions

CENG 793. On Machine Learning and Optimization. Sinan Kalkan

Machine Learning

INF 5860 Machine learning for image classification. Lecture 14: Reinforcement learning May 9, 2018

Support Vector Machines: Training with Stochastic Gradient Descent. Machine Learning Fall 2017

Overfitting, Bias / Variance Analysis

STA141C: Big Data & High Performance Statistical Computing

Regression with Numerical Optimization. Logistic

Sequential and reinforcement learning: Stochastic Optimization I

Bits of Machine Learning Part 1: Supervised Learning

CS229 Supplemental Lecture notes

18.9 SUPPORT VECTOR MACHINES

Introduction to Logistic Regression

Lecture 10: Logistic Regression

CS-E3210 Machine Learning: Basic Principles

Computer Vision Group Prof. Daniel Cremers. 6. Mixture Models and Expectation-Maximization

Scuola di Calcolo Scientifico con MATLAB (SCSM) 2017 Palermo 31 Luglio - 4 Agosto 2017

FINAL: CS 6375 (Machine Learning) Fall 2014

Machine Learning

Machine Learning Basics Lecture 4: SVM I. Princeton University COS 495 Instructor: Yingyu Liang

Machine Learning. CUNY Graduate Center, Spring Lectures 11-12: Unsupervised Learning 1. Professor Liang Huang.

MIDTERM SOLUTIONS: FALL 2012 CS 6375 INSTRUCTOR: VIBHAV GOGATE

Regression and Classification" with Linear Models" CMPSCI 383 Nov 15, 2011!

Machine Learning Lecture 7

CS60021: Scalable Data Mining. Large Scale Machine Learning

Machine Learning (CS 567) Lecture 2

Statistical Data Mining and Machine Learning Hilary Term 2016

EXAM IN STATISTICAL MACHINE LEARNING STATISTISK MASKININLÄRNING

Optimization and Gradient Descent

Machine Learning and Data Mining. Linear classification. Kalev Kask

Last updated: Oct 22, 2012 LINEAR CLASSIFIERS. J. Elder CSE 4404/5327 Introduction to Machine Learning and Pattern Recognition

Midterm: CS 6375 Spring 2018

Machine learning for pervasive systems Classification in high-dimensional spaces

Introduction to Machine Learning. Regression. Computer Science, Tel-Aviv University,

Analysis of Interest Rate Curves Clustering Using Self-Organising Maps

CS145: INTRODUCTION TO DATA MINING

RegML 2018 Class 8 Deep learning

ECS171: Machine Learning

Linear Models for Classification

Lecture 2 - Learning Binary & Multi-class Classifiers from Labelled Training Data

CMSC858P Supervised Learning Methods

Protein Complex Identification by Supervised Graph Clustering

Error Functions & Linear Regression (1)

In this chapter, we provide an introduction to covariate shift adaptation toward machine learning in a non-stationary environment.

Unsupervised Anomaly Detection for High Dimensional Data

CPSC 540: Machine Learning

Importance Reweighting Using Adversarial-Collaborative Training

Error Functions & Linear Regression (2)

Machine Learning. Lecture 3: Logistic Regression. Feng Li.

CPSC 340: Machine Learning and Data Mining. Stochastic Gradient Fall 2017

Support vector machines Lecture 4

Introduction to Machine Learning

Learning theory. Ensemble methods. Boosting. Boosting: history

Bregman Divergences for Data Mining Meta-Algorithms

MIDTERM: CS 6375 INSTRUCTOR: VIBHAV GOGATE October,

CSC321 Lecture 4: Learning a Classifier

SUPERVISED LEARNING: INTRODUCTION TO CLASSIFICATION

Unsupervised Learning with Permuted Data

CSC321 Lecture 4: Learning a Classifier

DECISION TREE BASED QUALITATIVE ANALYSIS OF OPERATING REGIMES IN INDUSTRIAL PRODUCTION PROCESSES *

Heuristics for The Whitehead Minimization Problem

Machine Learning for NLP

Logic and machine learning review. CS 540 Yingyu Liang

Lecture 3: Multiclass Classification

Machine Learning Practice Page 2 of 2 10/28/13

Neural Networks. Single-layer neural network. CSE 446: Machine Learning Emily Fox University of Washington March 10, /9/17

c 4, < y 2, 1 0, otherwise,

Interpreting Deep Classifiers

CPSC 340: Machine Learning and Data Mining. More PCA Fall 2016

Transcription:

1 Predictive analysis on Multivariate, Time Series datasets using Shapelets Hemal Thakkar Department of Computer Science, Stanford University hemal@stanford.edu hemal.tt@gmail.com Abstract Multivariate, Time Series analysis is a very common statistical application in many fields. Such analysis is also applied in large scale industrial processes like batch Processing which is heavily used in Chemical, Textile, Pharmaceutical, Food processing and many more industrial domains. The goals of this project are 1. Explore the usage of Supervised learning techniques like Logistic regression and Linear SVM to simplify and convert the dimensionality of multivariate dependent variable to a confidence score, indicating whether the batch production is on-spec or off-spec. 2. Instead of using classical Multivariate classification techniques like PCA/PLS or Nearest neighbour methods explore the usage and application of novel concept of Time Series shapelets towards predicting the qualitative outcome of a batch. I. INTRODUCTION Multivariate, Time Series analysis is a very common statistical application in many fields. Furthermore, with the arrival of Industrial Internet (IIoT) more and more processes are being instrumented for better accuracy and predictability, thus producing a large amount of sensor data. Performing online, predictive analysis for such high dimensional and time varying data is already becoming a challenging task. The current research and applications for Predictive analysis on batch datasets heavily rely on Time Warping and PLS based techniques. The aim of this project is to simplify the process of predicting batch quality outcomes by using current research in the field of representative temporal sub-sequences like shapelets. This project will particularly focus on the problem statement of predicting the quality outcome of an industrial batch process using a combination of initial charge variables and time series information. II. LITERATURE REVIEW AND PROBLEM DESCRIPTION There has been an extensive amount of research on Multivariate, Time Series analysis that involve dealing with use cases like Pattern recognition (1), Classification (2), Forecasting (3) and Anomaly detection (4). Several Machine Learning techniques are used to address these problems. A comprehensive survey of theoretical aspects is covered in (5) for forecasting techniques. This project will particularly focus on the problem statement of predicting quality outcome for Industrial Batch processing use case. For such cases, algorithms like Dynamic time warping (6) are used with supervised learning techniques like Nearest Neighbour search for finding similarities, querying and data mining of temporal sequences. We notice that with such time warping there is a risk of loosing important temporal variations in the time series data that could aid in prediction of qualitative outcome of the final batch. Thus instead of using time warping we propose the use of temporal sub-sequences which can act as a representative of quality class. III. DATA SET, NOTATIONS AND PROBLEM STATEMENT To further elaborate on the problem statement we first introduce notations and describe terminology that will be used throughout the paper. To aid our notation we will use the dataset that is acquired to test and verify our analysis and results. We will be using a Batch dataset from a Chemical process, though the underlying chemistry is not of significant relevance one can refer (7) for a better description of underlying chemical process. The dataset we will use is very similar to the one referred in (7), hence in this paper we will only describe the variables used for predictive analysis instead of full details and background of the Chemical process. Particularly we refer to a Batch dataset b i as a collection of following 3 data structures : {z i, x i, y i }. For our analysis we have acquired a data set of more than 80 batches, however after removing anomalous and missing data values the algorithms are executed on 33 batches as described in following sections. Consider the following notation and properties of the dataset: Total number of Batches: B = 33, represented by b i for i = 1... 33 Initial chemical properties of each batch b i : z i R k where k is number of initial chemical properties measured for each batch. These properties are measured at time t = 0 before the batch process starts and are also referred to as initial charge variables. Multivariate product Quality parameters: y i R j where j is the total number of quality measurements taken at the end of each batch process. Final product Quality: Q i {1, 1} with 1 = Onspec i.e. the final quality of batch i were as per the

2 Fig. 1: Batch trajectories specifications and -1 = Off-Spec i.e. the final quality of batch i was not as per the expected specifications. Time series process variable trajectories as they evolve during the batch processing: x n i such that n is the number of trajectories or time series variables measured during the batch process. Thus x (n,t) i R is one reading of n th process variable of i th batch taken at time t. See figure 1 for a visual representation of 3 trajectories evolving from time t = 0 to 160 In our case, n = 10, t varies for each i but remains constant across all n variables, k = 11 and j = 11. Note that y i and z i may or may not represent the same chemical measurements. Also note that y i R j is multidimensional measurement of the output quality parameters whereas Q i {1, 1} represents the final quality flag for each batch. For brevity we have not formally defined the concepts of Time Series, Subsequence and Shapelet in this project. Instead we closely follow the definitions described in (9) and (10) Given the variability within all n trajectories in x i it is difficult to align the trajectories across batches based on any single variable, hence techniques like Time warping as described in (6) are used for accurate comparison. However such manipulation may introduce distortion in time series values. Furthermore, it is difficult to identify noticeable Landmarks within the dataset due to variance across n variable trajectories. To address this and exploit the temporal nature of trajectories we propose use of shapelets as representative Fig. 2: Confidence Scores temporal subsequences to predict final quality output Q i. The prediction pipeline is structured as follows: Firstly, y i will be used to derive Confidence scores as explained in section IV. Secondly in section V we show a few sample shapelets identified manually whereas in Section VI we implement the algorithm as mentioned in (10) to learn high entropy representative shapelets directly from dataset. Lastly in section VII and VIII we summarize the results obtained by using combination of z i and shapelets distances to predict Q i.

3 Fig. 3: Shapelets: A visual intuition on one process trajectory Fig. 4: Pressure variance with Confidence score. Diverging from Green (1: On-Spec) to Purple (-1:Offspec) IV. DATA PRE-PROCESSING AND LEARNING CONFIDENCE SCORES In this section we try to simplify the multivariate output y i to uni-variate confidence score. For this purpose we implement Regularized Logistic regression as described in (11) and (12) with y i as input to learn classification output Q i. The confidence score is nothing but θ T y i i.e. the distance of each y i from separating hyperplane. This score indicates the degree of On-Spec/Off-Spec quality measure and transforms data from {1, 1} to R. For brevity the implementation details of logistic regression, data cleaning and removal of anomalies are not listed here, instead figure 2 shows the final summary of positive (on-spec) or negative (off-spec) score for each batch. V. SHAPELETS, INTUITION AND VISUALIZATIONS As per (9) Shapelets are informally defined as Temporal subsequences present in the time series data set which act as Maximal Representatives of a given class. In this section we provide visual motivation to use shapelets for our use case. After finding the confidence score in section IV we find top-4 batches which can informally represent batch in each class: a) Highest degree of On-Spec (Max. Positive Confidence) and b) with Highest degree of Off-Spec (Lowest confidence). We find that Batch Ids: {66, 14, 68, 13} represent positive class whereas {48, 45, 55, 53} represent negative class where all Ids are in decreasing order of respective degrees. By simply visualizing trajectories of each variable we find that we can derive temporal subsequence which can uniquely represent a given class. For eg: figure 3 represents one such trajectory variable. The Green boxes represent Positive class whereas Red boxes are very dissimilar to the Positive pattern. We use this pattern as representative of positive class in this Fig. 5: Temperature variance with Confidence score. Diverging from Green (1: On-Spec) to Purple (-1:Offspec) example. Similarly shapelets representing negative class were also found. Furthermore figures 4 and 5 display time series data using confidence scores as colors to visualize the temporal placements and sequencing of On-Spec (Green) and Off-Spec (Purple) batches. VI. LEARNING REPRESENTATIVE SHAPELETS DIRECTLY FROM DATA In this section we describe the algorithm implemented for identification of representative shapelets. We closely follow and refine the extensive research implemented in (10). For brevity we have not re-written the methods discovered in (10), instead we will only describe the refinements applied to make the model usable for our dataset. We have used Binary classification model (see Section 3) instead of Generic model described in Section 5. We will refer to this Binary classification model as LTS model. We recommend the reader go through (10) (mainly Sections 3 and 4) for a better understanding of the refinements performed in this project.

4 The implementation learns representative shapelets and associated weights directly from data. The learning is performed using Stochastic Gradient Descent for optimization on one time series in each iteration. Equations relevant to describe the updated algorithm for our dataset are described below: ˆQ i represents the estimated quality of i th batch: ˆQ i = W 0 + K M i,k W k (1) k=1 L represents length of one shapelet and hence length of segments of time series data. D i,k,j represents distance between j th data segment of i th time series and k th shapelet D i,k,j = 1 L L (x (n,j:j+l) i S k,l ) 2 (2) l=1 M i,k represents the distance between a time series x (n,:) i and k th shapelet S k. M i,k = min j=1...j D i,k,j (3) In order to compute derivatives, M i,k is estimated by using Soft Minimum function approximation given by ˆM i,k ˆM i,k = J j=1 D i,k,je αd i,k,j J j =1 D i,k,j (4) Loss functions are same as equations 3 and 7 from (10) Below are the updated derivative equations modified to address our dataset: F i = L(Q i, ˆQ i ) ˆQ i S k,l ˆQ i ˆM i,k J j=1 ˆM i,k D i,k,j D i,k,j S k,l (5) L(Q i, ˆQ i ) ˆQ i = (Q i σ( ˆQ i )) (6) ˆQ i ˆM i,k = W k (7) ˆM i,k = eαdi,k,j(1+α(di,k,j ˆMi,k)) D J i,k,j j =1 eαd i,k,j D i,k,j S k,l (8) = 2 L (S k,l x (n,j+l 1) i ) (9) F i = (Q i σ( W ˆQ i )) ˆM i,k + 2λ W W k (10) k I F i W 0 = (Q i σ( ˆQ i )) (11) Equations 1 to 11 represent the basis of our implementation. Algorithm 1 described in (10) is updated to address: The variable nature of our time series data Improve algorithmic efficiency to reduce the processing time by pre-calculating ˆM i,k and ψ i,k = J j =1 eαd i,k,j (Phase 1) which can be reused when iterating through each time series reading (Phase 2). Our version of algorithm is described in Algorithm 1. The Weights W k, intercept W 0 and Shapelet set S k can be used to predict Q i for any batch using Equation 1 Algorithm 1 Learning Time Series Shapelets Require x n i, number of shapelets K, Length of a shapelet L, Regularization parameter λ W, Learning rate η, Max Number of iterations: maxiter, Soft Min parameter α 1: procedure f it() 2: Initialize centroid using K Means clustering for variable TS data 3: S k,l getkmeanscentroid(x n i ) 4: Initialize weights randomly 5: W k, W 0 random() 6: for iter = 1...maxIter do 7: for i = 1...I do 8: for k = 1...K do 9: Phase 1: Prepare data for x i and S k 10: W k W k η Fi W k 11: ˆMi,k, ψ i,k calcsoftmindist(x n i, S k) 12: Phase 2: Iterate through the TS data 13: for l = 1...L do 14: S k,l S k,l η Fi S k,l 15: end for 16: end for 17: W 0 W 0 Fi W 0 18: end for 19: end for 20: return W k,w 0,S k 21: end procedure LTS Model Initialization and Convergence: The Loss function defined for LTS Model is a Non-Convex function in S and W hence convergence of the model is not guaranteed when using optimization techniques like Stochastic Gradient Descent. This combined with variable nature and multiple time series datasets within one batch makes convergence even more difficult. Hence initializing shapelets to true centroids is very important for convergence and learning algorithm. Clustering techniques like KMeans and K-NN were evaluated for initialization. The performance of both algorithms lead to a similar precision but K-NN technique required larger processing time. Hence KMeans was used for simple clustering of data segments. Figure 6 shows a visualization of Centroids derived for one of the parameters using KMeans algorithm. VII. RESULTS Various techniques were evaluated to predict Q i, first using z alone and then a combination of predictions obtained by

5 Feature and Model Selection Test Observation accuracy Linear Regression using z i to predict Q i 0.56 Slightly better than random guessing but not a usable model. Logistic Regression using z i to predict Q i 0.64 Better model, but still low accuracy. Proves that initial condition do not fully determine the final quality measure. Predict Q i using algorithm described in 0.67 Shows only minor improvement, proves that time series Algorithm 1 without using z Logistic Regression using z i and M i,k as defined in equation 3 using learned shapelets to predict Q i Logistic Regression using z i and M i,k as defined in equation 3 using learned shapelets to predict Q i, combined with Cross Validation and Grid search on Hyper parameters described in Table II. alone may not be enough to get higher accuracy. 0.75 Promising improvement without much work on parameter tuning. The only parameter that required tuning was Soft Min parameter α since the model would not converge without tuning of Soft Min condition. 0.80 Significant improvement in accuracy, but the training time and complexity also increased significantly TABLE I: Test accuracy defined as average fraction of correct test predictions, note that the test data had equal number of +1 and -1 quality hence the model did not suffer from irregular Recall measure. Fig. 6: Centroids visualization using Representative shapelets. Table I summarizes the results. Also for the model to converge and produce workable results a considerable amount of effort was required to find workable range of hyper parameters, the ranges are summarized in Table II VIII. SUMMARY AND FUTURE WORK Firstly, Supervised learning techniques were used to improve visualization techniques on Batch, Multivariate, Time Series datasets. And the intuition developed was used to verify if Shapelets can be used for predicting a batch s quality outcome. Secondly, LTS model algorithm was implemented to learn Representative shapelets on the available datasets. Lastly an array of Machine learning techniques were used in conjunction with available data and learned shapelets to predict quality outcome of batches. Below is a list of aspects Hyper Parameter Description Regularization parameter for learning weights on z i Symbol Workable Range C 0.5-0.7 Soft minimum parameter α -1 to -5 Number of shapelets K 3 to 7 Length of each L 20 to 40 shapelet Shapelet Learning η S 0.05 to 0.1 rate Shapelet Learning λ W 0.001 to regularization 0.003 parameter TABLE II: Hyper Parameters and workable ranges which can be improved or worked upon in follow up research projects: Shapelet learning can be improved in various ways. Eg: Use alternatives to Soft Minimum Function, Find α as a function of Time Series vector length or improve shapelet initialization by exploring different Unsupervised learning techniques. Use a combination of Time Warping and Shapelet learning techniques. Update Algorithm 1 to simultaneously learn weights on shapelet distance from all time series variables and initial conditions z i.

6 REFERENCES AND NOTES 1. Pattern Recognition and Classification for Multivariate Time Series 2. Multivariate Time Series Classification by Combining Trend-Based and Value-Based Approximations 3. Forecasting performance of multivariate time series models with full and reduced rank: an empirical examination 4. Detection and Characterization of Anomalies in Multivariate Time Series 5. Machine Learning Strategies for Time Series Prediction 6. Querying and mining of time series data: experimental comparison of representations and distance measures 7. Trouble-shooting of an industrial batch process using multivariate methods 8. Multivariate SPC Charts for Monitoring Batch Processes 9. Time Series Shapelets: A New Primitive for Data Mining 10. Learning Time-Series Shapelets 11. CS229 Notes Supervised Learning : Classification 12. CS229 Notes Regularization and model selection