Probabilistic Graphical Model Based on Growing Neural Gas for Long Time Series Classification

This article proposes a generative probabilistic graphical model with hidden states (Neural Gas Graphical Model (NGGM)) based on data approximation with a grid of "neural gas" nodes aimed at solving the problem of long time series classification. Such time series include information about changes in economic, weather and health values, as well as information about changes in values of operation sensors of technical objects during a quite long period. The most difficult task of classification of such long time series using probabilistic graphical models with hidden states is the selection of the optimum number of hidden states. This work proposes a method for automatic selection of the optimum number of hidden states of the model in the course of the model learning. The model proposed in the article and the methods of its learning are based on a combination of elements used in the metric and Bayesian approaches to classification. The basic NGGM purpose is to match hidden states of a graphical model and nodes (neurons) of the approximating grid. Comparative assessment of the quality of the proposed NGGM model classification with the currently most common time series classification models has been made: the HMM (Hidden Markov Model) and the HCRF (Hidden Conditional Random Fields) applied at the data sets from the UCI repository. The quality was assessed by the macro-average F-measure criterion using the k-fold cross-validation. As a result of classification quality analysis, it was noted that the proposed NGGM model showed better classification quality on the data set being a set of multiple, labeled samples of pen tip trajectories recorded whilst writing individual characters than the HCRF and HMM models.


Introduction
Probabilistic graphical models with hidden states are used for time series classification (Koller and Friedman, 2009).For solving the classification problem, the machine learning methods based on probabilistic graphical models such as HMM (Rabiner, 1989) and HCRF (Gunawardana et al., 2005) have proven to be efficient.These models imply either availability of a priori information about the number of hidden states or experimental selection of their optimal number (Soullard and Artieres, 2011).In case of the long time series representing information about a process lasting during a sufficiently long period, there is no a priori information about the required number of hidden states.Such processes include changes of economic, weather, and health indexes over time, and changes in readings of technical objects sensors (Grabocka et al., 2012).For classification of such time series, the criteria for selection of the optimum number of hidden states are most relevant, since a random increase in the number of hidden states results in a considerable increase in model parameters, which in turn results of overfitting.
The problem of selection of the optimum number of parameters of probabilistic graphical models is an important theoretical problem.The most popular criteria for selecting the number of hidden states are AIC (Akaike Information Criterion), BIC (Bayesian Information Criterion), ICL (Integrated Completed Likelihood), and PML (Penalised Marginal Likelihood).They are used for selection of the number of hidden states in HMM and are based on maximum likelihood (ML) estimation of the models (Celeux and Durand, 2008).A well-known difficulty is non-regularity in their maximum likelihood estimators, under which classical information criteria lose their theoretical justifications.Roughly speaking, Fisher information matrices around the ML estimators are singular, and thus an asymptotic second order approximation is not applicable (Fujimaki and Hayashi, 2012).The most successful solution for classification of long time series with selecting the optimal number of hidden states is the concept of the infinite Hidden Markov Models (iHMM) (Beal et al., 2002).In order to describe the infinite number of iHMM states, the hierarchical Dirichlet process is used, and the number of states is determined based on three predefined hyper-parameters.The necessity of setting these hyper-parameters does not allow automating fully the process of selecting the optimum number of states.
Thus, the objective of this work is the development of a probabilistic graphical model for classification of long time series and automatic evaluation of the optimum number of model's hidden states during learning.
In this article, we propose a probabilistic graphical model based on approximation of training data with a grid of nodes built according to the algorithm of growing "neural gas".The algorithm of growing "neural gas" (11 Martinetz and Schulten, 1991) refers to a broad class of methods for principal manifolds building (Gorban et al., 2008).The main idea of the proposed graphical model is to set up a correspondence between hidden states and nodes (neurons) of the approximating grid.At that, observation conformity to a particular hidden state is assessed by calculating the distance between them and by the subsequent normalization in the range between 0 and 1.The advantage of the growing "neural gas" algorithm is the possibility to find the optimal number of the approximating grid nodes based on the characteristics of the data itself, and the main problem is to define the criterion for stopping the increase in the number of grid nodes.While resolving the problem of clustering, the problem is solved by using the criterion of calculating the local neuron error or by calculating the total clustering error (Holmstrom, 2002).We propose finding the optimal number of grid nodes based on the classification quality assessment by the F-measure indicator of the training and validation sampling after each new node to the grid is added.0 We will compare the proposed model to the HMM (PMTK, 2010) and HCRF (HCRFLIB, 2010) models, and evaluate the classification quality using the k-fold cross-validation method and counting the F-measure criterion averaged over all classes on data sets from the UCI repository (UCI Arabic Digit, 2010; UCI Character, 2008).

Neural Gas Graphical Model
The model proposed in the work and the methods for learning it are based on a combination of elements used in the metric and Bayesian approaches to classification.Let us call it the Neural Gas Graphical Model (NGGM).Some parameters of this model are the approximating grid nodes' values.Such a set is typically unique for each class, whereby it is possible to perform classification on its basis by assessing the distance between the data being classified and the grid nodes.The distance normalized in the range between 0 and 1 between the observed data and each grid node may appear as an analog to the probability of occurrence of the data observed in hidden states and be used in algorithms of probabilistic inference.The measure for calculating the distance is chosen based on the data singularities.In this work, we consider only the Euclidean distance, which is calculated as the 2 L -norm of the difference vector between two points in Euclidean space.The required number of hidden states (grid nodes) in the proposed model is evaluated after each iteration of the growing "neural gas" algorithm, i.e. after adding a new node.The evaluation resides in calculating the classification quality of a trained model with the current number of nodes on the training and validation sets.
The NGGM structure is shown in Figure 1.White dots designate the observed data and black dots designate the nodes of the approximating grid (neurons)., ( Where t u is the number of node (neuron) of the approximating grid, taking values between 1 and N , where N is the number of nodes; t x is the data observed at a moment t ; t is the number of current observation; T is length of the observed time series; is the observed time series; is the distribution of transition probabilities between states of the model (between nodes of the approximating grid); is the normalized factor function defining the relationship between the current node of approximating grid and current observation.
The optimum value of hidden states ("neural gas" grid nodes) is selected as is the validation set with cardinality 2 m ; y is the true value of the class, to which the sequence X belongs, where C is the number of classes; * y is the classifier response about the membership of the sequence X; is the model for the class y ; W is the set of values of approximating grid nodes; A is the matrix of probabilities transition between grid nodes; L is the log-likelihood function.
Fmera is the function of F-measure, which is a weighted harmonic means of precision and recall of the classifier.
of discrete random variable by the method of maximum likelihood is limited to calculating frequency of observation of a particular event.In this case, such an event is a transition from one grid node to another, probability of which is calculated as ij a Where ij γ is the number of transitions from one grid node with number i to another one with number j in a single time series, is the number of grid node that corresponds to the vector t x .
Let us define the value of the non-normalized factor ~( , ) Where is the distance between the weight vector i w of the node i and the observed vector t x in the Euclidean space.
For the values of this factor to be used for calculating the likelihood, values of the matrix B ~ elements should be normalized, i.e., the matrix B satisfying the following two conditions should be formed: Normalization of values of probabilities distribution is a standard procedure in mathematical statistics that is often used to normalize the distribution histograms.It should be noted that the distance between the observation t x and nodes of the map is highly irregular in the sense that the value of distance to most nodes of the map will have a relatively large value, and will have a sufficiently small value only for one ("best matching node") or several nodes.In this regard, we use normalization in logarithmic space: where l is the vector of logarithmic normalization constants ( 1 : × T l ).

Learning and Inference
Let us consider the steps of model training.The purpose of training is to obtain models of the observed data in , containing the optimum number of hidden states N .For the NGGM training, an algorithm has been developed, consisting of the following steps.
Step 1.This step resides in carrying out one iteration of the growing "neural gas" algorithm for obtaining a new node (neuron) of the approximating grid.For each class y, a separate approximating grid of nodes is built based on the data set ) ( y Z .As a result of learning, each node i u will correspond to the weight vector W w i ∈ .
Step 2. This step includes estimation of conditional distribution of probabilities ) | ( Step 3.This step resides in calculation of likelihood of the obtained model parameters to the union set J Z ∪ , which is the union of training and validation sets.In order to calculate the likelihood, we shall use the "forward step" recursive procedure of the "forward-backward" algorithm.Using the expression (3) for calculating distances and expression (4) for their normalization, we obtain values of the factor Step 5.This step includes evaluation of changes in the F-measure criterion value (expression 1): -if in the course of several iterations of the growing "neural gas" algorithm the value of the F-measure criterion is consistently reduced or remains unchanged, addition of new nodes (neurons) to the model should be stopped, and this model should be deemed to be an optimum one; -if in the course of several iterations of the growing "neural gas" algorithm the value of the F-measure criterion increases, we proceed to Step 1 of the training algorithm and continue adding nodes (neurons).

Experimental Results
Let us perform comparative evaluation of the HMM and HCRF models, and the "Neural Gas Graphical Model" (NGGM) model proposed in this article at solving the problem of classification using on data sets from the UCI machine learning repository.
The following characteristics of the tested models have been used.Initialization of parameters of the models: HMM -with the k-means algorithm, HCRF -with random values, and NGGM does not require initialization.The learning method: HMM -by the algorithm Baum-Welch, HCRF -by the BFGS quasi-Newton optimization algorithm.Regularization method: HMM -without regularization, HCRF -2 L -regularization.The Gaussian density function was used as the function of density of data distribution in the HMM model.

Evaluation of the 2
L -regularization parameter for the HCRF model, the number of hidden states for the HMM and HCRF models was carried out at a validation set which is 10% of the data set.The "Spoken Arabic Digit Data Set" (UCI Arabic Digit, 2010) is a data set of 8,800 pronounced digits in the Arabic language that are time series of 13 cepstral coefficients.The number of classes is 10.The number of attribute space dimensions is 13.The number of instances of each class is 880.The average time series length T = 45.
The "Character Trajectories Data Set" (UCI Character, 2008) includes trajectories of pen movement obtained at writing down letters of the English alphabet on a Wacom tablet.The data consist of three parameters: the point coordinate on the axis of abscissas, axis of ordinates, and the pen pressure.The data have been smoothed and normalized.The number of classes is 20.The number of attribute space dimensions is 3.The number of instances of each class is 100.The average time series length T = 180.
The classification quality was evaluated according to the k -fold cross-validation method.Experiments were performed at the k value equal to 10.As a measure of quality evaluation, we used the balanced F-measure averaged over all classes.
The results of classification quality evaluation by the method of k -fold cross-validation are shown in Table 1.As a result of classification quality analysis assessment, the following can be noted: -on the "Character Trajectories Data Set", the average length of time series in which T = 180, the proposed NGGM model showed classification quality by 1.87% better than the HCRF model and by 5% better than the HMM model; -the effect of overfitting on the proposed model has not been observed.
Other NGGM's advantages include the possibility of using various distance functions depending on particular data.The NGGM's disadvantages include a much larger number of hidden states compared to the HMM and HCRF models, which results in an increased classification execution time.
Based on the results of the work, we can conclude that the developed NGGM model is well suited for classification of long time series and can be used as a basis of a system of technical objects fault diagnostics based on the analysis of sensor readings during a sufficiently long period.

Discussion
In this article, the model for classification of long time series based on the theory of probabilistic graphical models and the growing "neural gas" algorithm have been proposed.Currently, there are many works representing hybrid models based on combining probabilistic graphical models and methods of principal manifolds building.For instance, these are the works by (Kurimo, 1997;Somervuo, 2000) that consider HMM together with Kohonen self-organizing maps, which are used to solve the problem of mathematical expectation initialization before estimation of probability distribution parameters p(x) on learning data of the Baum-Welch algorithm.Also other works are known, such as (Calinon and Billard, 2005), which use vector quantization grids as a method of reducing the number of attribute space dimensions for the HMM classifier.Beside continuous HMM with the Gaussian probability density function, there are discrete HMM with discrete distribution and approximation of distribution using vector quantization grids (Neukirchen et al., 2001;Osterndorf and Rohlicek, 1990).However, this approach proved inefficient due to the low quality of classification (worse than that of continuous HMM) and the need for a large amount of training data.
Unlike the above-mentioned works, this article proposes the generating graphic probabilistic NGGM model that does not require evaluating of the observed data occurrence probability and selecting the form of the probability distribution density function (normal, exponential, etc.).This considerably broadens applicability limits of the NGGM model, since not all real-world data correspond to the known parametric families of probability distributions, or may be described in terms of probability (frequency of occurrence).The distance normalized in the range between 0 and 1 distance between the observed data and each grid node is an analog to the probability of occurrence of the data observed in hidden states and is used in algorithms of probabilistic inference.

Conclusion
The work presents a generative probabilistic graphical model with hidden states based on data approximation with a grid of "neural gas" nodes for solving the problem of classification of long time series.The probabilistic graphical model structure is described, where each hidden state corresponds to a node of the approximating grid, and the probability of transition to the new node depends only on the current node.An algorithm of model learning has been proposed, which selects the optimum number of hidden states (of the approximating grid nodes) based on evaluation of classification quality through validation sets by the F-measure criterion after each iteration of the "growing neural gas" algorithm.Probabilistic inference for calculation of likelihood is made by the "forward-backward" algorithm with normalization in logarithmic space of the distance between the data observed and each node of the grid.
Comparative evaluation of classification quality of the proposed NGGM model with the HMM and HCRF models has been made on data sets from the UCI repository.Quality was assessed by F-measure criterion using the k-fold cross-validation.As a result of classification quality evaluation analysis, it was noted that on the "Character Trajectories Data Set" data set, in which the average length of time series is T = 180, the proposed NGGM model showed classification quality by 1.87% better than the HCRF model, and by 5% better than the HMM model.
Based on the results of this work, we conclude that the developed NGGM model is well suited for classification of long time series and can be used as a basis of a system of technical objects (e.g., aviation engines) fault diagnostics based on the analysis of sensors readings (e.g.pressure and temperature sensors) during a sufficiently long period.
Disadvantages of the NGGM include a considerably larger number of hidden states compared to the HMM and HCRF models, which results in an increased classification time.Advantages of the NGGM include the possibility of efficient evaluation of the optimum number of hidden states, the high quality of classification of long time series, and the possibility to use different distance functions depending on specific data.
In the future, in order to calculate the likelihood, instead of the "forward-backward" algorithm that has high computational complexity, we expect to develop our own method based on such sampling methods as the Gibbs sampling and the Markov chain Monte Carlo, which can result in a considerable shortening of classification time without any loss of the classification quality.

Figure 1 .
Figure 1.The NGGM structure as a probabilistic factor graph This step includes classification and evaluation of classification quality by F-measure criterion averaged over all classes based on likelihood values.Classification is made based on the entire set

Table 1 .
Results of the classification quality evaluation