TodyNet: Temporal Dynamic Graph Neural Network for Multivariate Time
  Series Classification
Multivariate time series classification (MTSC) is an important data mining
task, which can be effectively solved by popular deep learning technology.
Unfortunately, the existing deep learning-based methods neglect the hidden
dependencies in different dimensions and also rarely consider the unique
dynamic features of time series, which lack sufficient feature extraction
capability to obtain satisfactory classification accuracy. To address this
problem, we propose a novel temporal dynamic graph neural network (TodyNet)
that can extract hidden spatio-temporal dependencies without undefined graph
structure. It enables information flow among isolated but implicit
interdependent variables and captures the associations between different time
slots by dynamic graph mechanism, which further improves the classification
performance of the model. Meanwhile, the hierarchical representations of graphs
cannot be learned due to the limitation of GNNs. Thus, we also design a
temporal graph pooling layer to obtain a global graph-level representation for
graph learning with learnable temporal parameters. The dynamic graph, graph
information propagation, and temporal convolution are jointly learned in an
end-to-end framework. The experiments on 26 UEA benchmark datasets illustrate
that the proposed TodyNet outperforms existing deep learning-based methods in
the MTSC tasks.
Huaiyuan Liu, Xianzhang Liu, Donghua Yang, Zhiyu Liang, Hongzhi Wang, Yong Cui, Jun Gu
# TodyNet: Temporal Dynamic Graph Neural Network for Multivariate Time Series Classification

###### Abstract

Multivariate time series classification (MTSC) is an important data mining task, which can be effectively solved by popular deep learning technology. Unfortunately, the existing deep learning-based methods neglect the hidden dependencies in different dimensions and also rarely consider the unique dynamic features of time series, which lack sufficient feature extraction capability to obtain satisfactory classification accuracy. To address this problem, we propose a novel temporal dynamic graph neural network (TodyNet) that can extract hidden spatio-temporal dependencies without undefined graph structure. It enables information flow among isolated but implicit interdependent variables and captures the associations between different time slots by dynamic graph mechanism, which further improves the classification performance of the model. Meanwhile, the hierarchical representations of graphs cannot be learned due to the limitation of GNNs. Thus, we also design a temporal graph pooling layer to obtain a global graph-level representation for graph learning with learnable temporal parameters. The dynamic graph, graph information propagation, and temporal convolution are jointly learned in an end-to-end framework. The experiments on 26 UEA benchmark datasets illustrate that the proposed TodyNet outperforms existing deep learning-based methods in the MTSC tasks.

Multivariate time series classification (MSTC), Dynamic graph, Graph neural networks (GNN), Graph pooling.

## I Introduction

Multivariate Time Series (MTS) is ubiquitous in a wide variety of fields as a significant type of data, ranging from action recognition [1], health care [2] to traffic [3], energy management [4], and other real-world scenario [5, 6, 7]. In the last decade, time series data mining has gradually become an important research topic, with the development of data acquisition and storage technology. The mining of time series data mainly covers three tasks: classification, forecasting, and anomaly detection. Multivariate Time Series Classification (MTSC) is the problem of assigning a discrete label to a multivariate time series, which assists people to judge the situation of the happened events.

Multivariate time series classification is challenging. On the one hand, the characterization of MTS is more complex due to its various temporal order correlations and high dimensionality, compared to the tasks of univariate time series classification. On the other hand, unlike temporally invariant classification tasks, the hidden information contained in MTS is more abundant and more difficult to be mined.

Numerous approaches have been proposed to settle the issue of MTSC over the years. Traditional methods have focused on distance similarity or features, such as Dynamic Time Warping with k-Nearest Neighbor (DTW-kNN) [8] and Shapelets [9], which have been validated to be effective on many benchmark MTS datasets. Nonetheless, the above-mentioned methodologies have to make the effort to data pre-processing and feature engineering due to the extraordinary difficulty of feature selection from the huge feature space. They fail to adequately capture the temporal dynamic relationships within the time series of each variable.

Recent research has turned to deep learning when solving end-to-end MTSC tasks because of the widespread applications of deep Convolutional Neural Networks (CNN) [10], whose benefit is that deep learning-based method can learn low-dimensional features efficiently rather than dealing with huge amounts of feature candidates. Many methods utilized for MTSC adapted to the multivariate case by converting the models originally designed for univariate time series. Fully Convolutional Network (FCN) [11] has a better overall ranking compared with traditional approaches. MLSTM-FCN [12] augments the FCN with a squeeze-and-excitation block to achieve better performance of classification. In addition, some approaches are specifically dedicated to MTSC by learning the latent features. These types of deep learning-based strategies have shown gratifying results in MTSC tasks. Unfortunately, current deep-learning-based models for the issue of MTSC rarely consider the hidden dependency relationships between different variables.

The dependency relationships can be naturally modeled as graphs. In recent years, Graph Neural Networks (GNNs) have been successfully utilized to processing of graph data by their powerful learning capability for graph structure. The neighborhood information of each node can be captured through the diverse structural information propagation of the graph neural network. Thrillingly, each variable can be characterized as a node in a graph for MTS, which are interconnected through hidden dependencies. Therefore, it is a promising way that models MTS data by graph neural networks to
mine the implicit dependencies between variables on the time trajectory. Spatial-temporal graph neural networks take an external graph structure and time series data as inputs, which can significantly improve the performance of the methods that do not exploit graph structural information [13]. However, only one graph is constructed over the entire temporal trajectory, which limits and neglects the impact of dynamic processes on representational ability. Thus, the following key issues and challenges should be valued.

* _Mining Hidden Dependencies._ Most models for MTSC focus on the extraction of inter-variable features but neglect the possibility that implicit dependencies between different variables. The question then is how to design an effective framework to capture these information.
* _Dynamic Graph Learning._ Most existing GNNs approaches rely heavily on predefined graph structures and only emphasize message propagation without considering the dynamic properties of time series data. Thus, how to dynamically learn the spatial-temporal features and graph structure of MTS is also an important issue.
* _Temporal Graph Pooling._ Most deep learning methods for MTSC pool a large number of dimensions directly at the end of models, which is called flat and may cause missing information. Some graph pooling methods have used GNNs to alleviate it [14, 15, 16], however, they did not consider the internal temporal features.

To address the above issues, we propose a novel **T**emporal **D**ynamic Graph Neural **N**etwork (TodyNet) for multivariate time series classification. For _mining hidden dependencies_, we propose a novel end-to-end framework that discovers the dependence correlations between variables, characteristics within variables, and spatial-temporal dependencies of variables by graph construction and learning, temporal convolution, and dynamic graph neural network, respectively. For _dynamic graph learning_, the internal graph structure can be learned by gradient descent, and we design a graph transform mechanism to propagate the dynamic properties of multivariate time series. For _temporal graph pooling_, a hierarchical temporal pooling approach is proposed to avoid the flat and achieve high performance. In summary, the main contributions of our work are as follows:

* _Pioneering._ To the best of our knowledge, this is the first study for multivariate time series classification based on the temporal dynamic graph.
* _Novel Joint Framework._ An end-to-end framework for MTSC is proposed to jointly learn the dynamic graph, graph propagation, and temporal convolution.
* _Dynamic Graph Mechanism._ A dynamic graph processing mechanism is proposed to capture the hidden dynamic dependencies among different variables and between adjacent time slots and enhance the effectiveness of graph learning.
* _Temporal Graph Pooling._ A brand-new temporal graph pooling is presented to avoid the flat of pooling methods, and combined with temporal features extraction simultaneously.
* _Remarkable Effect._ Experimental results show that our method significantly improves the performance of mainstream deep learning classifiers and outperforms state-of-the-art methods.

The remainder of this paper is organized as follows. Section II briefly introduces the related works. Section III is devoted to presenting the problem formulation, the notation, and the definition of the related concept. The details of the proposed TodyNet are described in Section IV. The experimental results and ablation studies are illustrated in Section V, which is followed by the conclusion.

## II Related Work

In this section, we briefly summarize the recent advances in multivariate time series classification tasks and spatial-temporal graph neural networks.

### _Multivariate Time Series Classification_

The multivariate time series classification problem expects to utilize time series data with multivariate features to accurately predict a number of specific classes [17, 18]. In general, distance-based, feature-based, and deep-learning-based methods are the three major types of approaches to address MTSC tasks. Multichannel Deep Convolutional Neural Network (MCDCNN) [19] captures features within variables by 1D convolution and then combined them with a fully connected layer, which is a pioneering approach that applied CNN to MTSC. Inspired by this, many effective network architectures began to spurt erupted. Time Series Attentional Prototype Network (TapNet) [20] learns the low-dimensional features by a random group permutation method and constructs an attentional prototype network to overcome the issue of limited training labels. Currently, OS-CNN [10] is the latest model that can achieve state-of-the-art performance by designing an Omni-Scale block to cover the best receptive field size across different datasets. Nevertheless, deep-learning-based models have obvious limitations. They assume that the dependencies between different variables are the same, resulting in the pairwise relationships between variables cannot be effectively represented. In this case, the graph is the most appropriate data structure to model the MTS.

### _Graph Neural Networks_

Since the concept of Graph Neural Networks (GNNs) was introduced [21], there has been an explosive development in the processing of graph information. GNNs follow a local aggregation mechanism in that the embedding vector of each node can be computed by recursively aggregating and transforming the information of its neighbors. In recent years, various variants of GNNs have been proposed [22, 23, 24, 25]. For example, the graph convolution network (GCN) [26] is a representative work that extends convolution to the spectral domain by finding the corresponding Fourier basis. GraphSAGE [27] and the Graph Attention Network (GAT) [28] are also typical approaches that generalize typical convolution to spatial neighbors. In order to simultaneously meet the need for spatial and temporal dimensions of the data, a new family
of GNNs has been born, i.e. spatial-temporal GNNs, which can learn the graph structure over temporal trajectories [29, 30, 31]. For example, [32] proposed a new model named STFGN for fusing newly generated graphs and given spatial graphs to capture hidden spatial dependencies and learn spatial-temporal features. Regretfully, it is difficult to find a predefined graph structure for the MTSC tasks. In addition, most of the current spatial-temporal GNNs are designed for traffic forecasting, there is a gap in the MTSC tasks that need to be filled.

## III Preliminaries

This section defines the key concept and notations of this paper. To begin with, we formulate the problem that we are interested in, multivariate time series classification.

### _Problem Formulation_

A Multivariate Time Series (MTS) \(X=\{x_{1},x_{2},...,x_{d}\}\in\mathbb{R}^{d\times l}\) denote the value of multivariate variable of dimension \(d\in\mathbb{N}^{*}\) at the time series with \(x_{i}=\{x_{i1},x_{i2},...,x_{il}\}\), \(i=1,2,..,d\), where \(l\in\mathbb{N}^{*}\) denote the length of the multivariate time series. Given a group of multivariate time series \(\chi=\{X_{1},X_{2},...,X_{m}\}\in\mathbb{R}^{m\times d\times l}\) and the corresponding labels \(\eta=\{y_{1},y_{2},...,y_{m}\}\), where \(y\) is a predefined class label of each multivariate time series, and \(m\in\mathbb{N}^{*}\) is the number of time series. The MTSC tasks are dedicated to predicting unlabeled multivariate time series by training a classifier \(f(\cdot)\) from \(\chi\) to \(\eta\).

### _Graph Notations and Definitions_

**Graph-related Concepts.** Graph generally describes relationships among entities in a network. In the task of multivariate time series classification, we give formal definitions of temporal graph-related concepts below.

**Definition 1** (Temporal Graph).: _The temporal graph is constructed by multivariate time series. A temporal graph is given in the form \(G=(V,E)\) where \(V=\{v_{1},...,v_{n}\}\) is the set of nodes with a number of \(n\), and \(E\) is the set of edges. The nodes denote the variables, and the edges denote the relationship among different variables defined as similarity or some structure learning results._

**Static and Dynamic Graph.** The static and dynamic graphs are defined by the temporal dependency of graph construction. Each multivariate time series \(X\) is segmented averagely by some isometric time slots \(T=\{T_{1},T_{2},...,T_{S}\}\) in chronological order, where \(S\in\mathbb{N}^{*}\) is the number of time slot. Generally, each time slot is denoted by \(T_{i}=\{t_{1+(i-1)s},...,t_{is}\}\), \(i=1,...,s\), \(|T_{i}|=s>0\). Given a set of temporal graphs \(G_{T}=\{V,E_{T}\}\) with the same nodes but different edges at each time slot, where \(G_{T}=\{G_{T_{1}},G_{T_{2}},...,G_{T_{S}}\}\), \(E_{T}=\{E_{T_{1}},E_{T_{2}},...,E_{T_{S}}\}\).

**Definition 2** (Static Graph).: _The static graph is a temporal graph for each multivariate time series with \(S=1\), \(i.e.\) there is no segmentation existence for each multivariate time series, and \(s\) is equal to the length of the whole time series. The size of sets \(|G_{T}|=|E_{T}|=1\)._

**Definition 3** (Dynamic Graph).: _The dynamic graph is a set of temporal graphs for each multivariate time series with \(S>1\), \(i.e.\) edges of the temporal graph have dynamic variations at different time slots. The size of sets \(|G_{T}|=|E_{T}|>1\)._

The dynamic variations of edges mean that the weight of

Fig. 1: The framework of TodyNet. We first split the input time series into \(s\) slices, and generate a dynamic graph for each slice. The dynamic graph neural network modules and temporal convolution modules capture spatial and temporal dependencies separately. Afterward, the temporal graph pooling module clusters nodes together with learnable temporal parameters at each layer. The output layer processes concatenate hidden features for final classification results.
edges and the connection relationship of vertices changes on different time slots while vertices stay statically constant for each multivariate time series.

## IV Proposed Model

In this section, we will introduce our new proposed TodyNet model. We first introduce the overall framework of TodyNet in Section IV-A. Then we demonstrate each component of our model in Section IV-B through Section IV-E.

### _Model Architecture Overview_

We first introduce the general framework of our proposed deep learning-based model TodyNet briefly. As illustrated in Figure 1, TodyNet is composed of the following core modules. To establish the initial relationships between different dimensions, a _graph construction and learning module_ generates a set of graph adjacency matrices, which correspond to different time slots respectively. And the elements of graph adjacency matrices can be learned with the iteration process. _\(k\) Dynamic graph neural network modules_ consists of dynamic graph transform and dynamic graph isomorphism network. Dynamic graph transform exploits the dynamic associations between different temporal graphs, whose results are implied in the new adjacency matrices. Dynamic graph isomorphism network processes time series data with \(k\)_temporal convolution modules_, which captures spatial-temporal dependencies of multivariate time series.

To avoid the flat pooling problem, the _temporal graph pooling module_ designed a differentiable and hierarchical graph pooling approach with learnable temporal convolution parameters. To obtain the final classification result, the _output module_ uses average pooling and a fully connected layer to get the values for each category. Our model will be introduced in detail in the following subsections.

### _Construction and Learning of Temporal Dynamic Graph_

Since there is no predefined graph structure for universal time series data, we will start by demonstrating a general graph-constructed module that generated adjacency matrices to create the initial associations of dimensions. Besides, the hidden dependencies between variables are represented by graph adjacency matrices and optimized with training iterations. For the sake of simplicity, we do not establish this relationship through time series data and encode the adjacency matrices by "shallow" embedding. Each node is assigned two values, which represent the source and target nodes, respectively. Therefore, we generated two vectors \(\Theta\) and \(\Psi\) with length \(d\) for each time slot \(t\), and all elements are learnable parameters that are initialized randomly. Then we computed the multiplication of \(\Theta^{\mathrm{T}}\) and \(\Psi\) whose result will be regarded as the initial adjacency matrix for a time slot. And the values of the adjacency matrix can be optimized by training. The graph construction is illustrated as follows:

\[A =\Theta^{\mathrm{T}}\cdot\Psi \tag{1}\] \[idx,idy =argtopk(A[:,:])\quad idx\neq idy\] (2) \[A[-idx,-idy]=0 \tag{3}\]

where, \(\Theta=[\theta_{t,1},\theta_{t,2},...,\theta_{t,d}]\), \(\Psi=[\psi_{t,1},\psi_{t,2},...,\psi_{t,d}]\) represent the random initialization of learnable node embeddings, and \(argtopk(\cdot)\) returns the indices of the top-k largest values of the adjacency matrix \(A\). The adjacency matrix is sparsized by Equation 2-3, which enables reducing the computation cost. For the adjacency matrix of each time slot, we only preserve the elements with the top-k largest weights and set other values as zero.

### _Dynamic Graph Neural Network_

We purpose to explore the spatial relationships between different time series dimensions and represent the interaction of their features in graphs. The dynamic graph neural network module focuses on message passing and feature aggregating between nodes. Though some GNNs models are able to propagate neighbor messages, the existing methods can only operate on static graphs. In this paper, we propose a novel model that processes message propagation for dynamic graphs based on an improved Graph Isomorphism Network (GIN).

**Dynamic Graph Transform.** We design a transformation on the set of dynamic graphs, which establishes the associations between different graphs. The basic assumption behind these time slots is that the later time slots data is transformed from the data in the earlier time slots. To discretization, we attempt to construct a connection with the graph corresponding to the previous time slot for each graph. The structure of Dynamic Graph Transform(DGT) is illustrated in Figure 2.

For each graph of time slot, the same number of vertices are added which characterize the data of the previous time slot graph of the corresponding vertices respectively, except for the first graph. Therefore, the set of vertices will be modified to \(\{v_{(t,1)},\ v_{(t,2)},...,\ v_{(t,N)},\ v_{(t-1,1)},\ v_{(t-1,2)},...,\ v_{(t-1,N)}\}\). We assign orientations (_i.e. directed edges_) from the previous time vertices to their counterparts at the current time, which signifies adding connections from \(v_{(t-1,n)}\) to \(v_{(t,n)}\) for \(n=1,2,...,N\). Then the latest generated set of graphs is able to be transported to the next steps.

Fig. 2: Dynamic Graph Transform. The latter graph aggregates information from the previous graph for corresponding nodes.
Actually, it is unnecessary to double the number of vertices in practical implementation. We can aggregate source nodes embedding to target nodes embedding directly for new directed edges, then delete the new vertices.

**Dynamic Graph Isomorphism Network (DyGIN).** Graph Isomorphism Network(GIN) is one of the powerful GNNs, which can discriminate different graph structures that other popular GNNs variants cannot distinguish. Motivated by GIN, we designed a novel method to aggregate information that consists of a dynamic paradigm through parallelism as Equation 5. In contrast to static GNNs, dynamic GNNs separate different time slot data in the same dimension completely after DGT. Actually, the same vertex at different time slots will aggregate information from a different set of vertices in general. The DyGIN can be defined as:

\[h_{v}^{(l,\,t)}=MLP^{(l,\,t)}\Big{(}\big{(}1+\epsilon^{(l)}\big{)} \cdot h_{v}^{(l-1,\,t)}+h_{v}^{(l-1,\,t-1)}+\] \[\sum_{u\in\mathcal{N}(v)}\tilde{\omega}_{ij}\cdot h_{u}^{(l-1,\,t )}\Big{)} \tag{4}\] \[h_{v}^{(l)}=CONCAT\Big{(}h_{v}^{(l,\,t)}\ \left|\ \ t=0,1,...,T\right. \tag{5}\]

where, \(h_{v}^{(l,\,t)}\) represents the output of GIN for node \(v\) at \(t\) time slot in \(l\) layer, \(h_{v}^{(l-1,\,t-1)}\) is the simple implementation for DGT, which is available for \(t>2\) (the second and subsequent graphs). The edge weight, \(\omega_{ij}\), is normalized to \(\tilde{\omega}_{ij}\). We can regard \(\epsilon\) as a learnable parameter.

We also provide the adjacency matrix form:

\[H^{l}=MLP\Big{(}\big{(}\tilde{A}+(1+\epsilon^{l})\cdot I\big{)}\cdot H^{l-1}+ H^{l-1}[t_{1}:t_{T-1}]\Big{)} \tag{6}\]

where, \(H^{l-1}\) represents the output tensor of \(l\)-th GIN layer, \(H^{l-1}[t_{1}:t_{T-1}]\) is aligned from the second time slot data, \(\tilde{A}\) is normalized through \(D^{-\frac{1}{2}}AD^{\frac{1}{2}}\), and \(D\) is the degree matrix of \(A\).

### _Temporal Graph Pooling_

In general, pooling is a necessary procedure after the classifiers have generated new features. However, some universal approaches of pooling, such as max pooling, mean pooling, and sum pooling, aggregate a vector even a matrix of features into a few features, which is _flat_ and may lose much information. To the best of our knowledge, there is no such method that deals with this issue in time series analysis. In this section, we propose a novel Temporal Graph Pooling (TGP) that combined graph pooling and temporal process, which can alleviate the difficulty.

Temporal Graph Pooling provided a solution through the _hierarchical_ pooling method. The core idea is to Learn to assign nodes to clusters, which can control the number of reducing nodes. We applied it hierarchically after each GNN layer, as illustrated in Figure 3.

**Pooling with convolution parameters.** A 2-dimensional convolution neural network(CNN) layer is designed to concentrate nodes into clusters according to the given parameter _pooled ratio_, and nodes are considered as the channels that extract features in CNN. In order not to break the window of the receptive field, the kernel size of temporal convolution is assigned to this convolution kernel size. \(X_{l}\) represents the input node embedding tensor at \(l\)-th layer, the CNN to compute the output embedding tensor \(X_{l+1}\) can be denote as:

\[X^{l+1}=\sum_{j=0}^{N^{l}-1}\text{weight}(N^{l+1},j)\star X^{l}+\text{bias}(N ^{l+1}) \tag{7}\]

where, \(\star\) is the valid 2D cross-correlation operator, \(N\) denotes the number of nodes in or out pooling module, note that \(N^{l}\) equals to in_nodes and \(N^{l+1}\) equal to out_nodes for \(l\)-th layer.

After the generation of output tensor \(X^{l+1}\), we consider the approach to compute the corresponding adjacency matrix. There is an observation that the shape of learnable weights \(W^{l}\) is [\(N^{l+1}\), \(N^{l}\), 1, kernel_size], then the vector \(V^{l}\in\mathbb{R}^{1\times k}\) composed of learnable parameters at layer \(l\) is generated. A learnable assigned matrix \(M^{l}=W^{l}\cdot V^{l}\in\mathbb{R}^{N^{l+1}\times N^{l}}\) can be obtained that the rows correspond to \(N^{l+1}\) nodes or clusters and the columns corresponds to \(N^{l}\) clusters. Given matrix \(M\) and the adjacency matrix \(A^{(l)}\) for input data at this layer, the following equation is utilized to generate output adjacency matrix \(A^{(l+1)}\):

\[A^{(l+1)}=M^{(l)}A^{(l)}M^{(l)^{T}}\in\mathbb{R}^{N_{l+1}\times N_{l+1}} \tag{8}\]

Equation 7-8 provides the overall steps of Temporal Graph Pooling(TGP). In Equation 7, \(X^{l+1}\) represents the output clusters embeddings after aggregating input embeddings. In Equation 8, \(A^{(l+1)}\) denotes the connection relationships and corresponding weights of new clusters. In addition, each element \(A^{(l+1)}_{ij}\) indicates the connected weight between \(i\) and \(j\). Therefore, TGP implements the hierarchical and differentiable graph pooling with temporal information, while optimizing the clusters aggregating approach during training.

### _Temporal Convolution_

The temporal convolution (TC) module focuses on the capture of temporal dependencies within each dimension. In contrast to other deep learning methods, to highlight the advantage of graph learning modules, there is no complex

Fig. 3: An abstract illustration of Temporal Graph Pooling. At each layer, we utilize time convolution to cluster nodes and extract the temporal features. Then we reconstruct adjacency matrices through convolution weights.
processing in this module. The 3 convolution neural network layers with different convolution kernels are employed and neither _dilation_ nor _residual connection_ are used for simplicity. However, _Padding_ is applied to extend the length of the time series, which makes the output of time convolution equal in length to the input data. The output tensor of temporal features extracting will be transported to the GNN module after dividing according to the corresponding time slots.

## V Experimental Studies

In this section, extensive experiments have been conducted on the UEA benchmark datasets for multivariable time series classification to show the performance of TodyNet. Furthermore, we validate the performance of key components of TodyNet with a series of ablation experiments. Moreover, we visualize the class prototypes and time series embeddings to illustrate the excellent representation capabilities of TodyNet.

### _Experimental Settings_

**Datasets.** UEA multivariate time series classification archive1 collected from different real-world applications covers various fields. We exclude the datasets with unequal length or missing values in the UEA multivariate time series classification archive [33], to ensure the rationality of experiments. Thus, we use all 26 equal-length datasets of the 30 total and most implementations are similar setups in other studies. The details statistics of the benchmark datasets are as follows: The UEA multivariate time series classification archive is composed of real-world multivariate time series data, and we choose 26 data of equal length in the time series of each dimension as the datasets. The length range of the datasets is from 8 to 17,984, and the range of dimension values is from 2 to 1345. The details of each dataset are shown in Table I.

Footnote 1: [https://www.timeseriesclassification.com](https://www.timeseriesclassification.com)

**Baselines.** To validate the performance of TodyNet, the state-of-the-art or most popular approaches are selected as baselines for comparison. Baseline methods for multivariate time series classification are summarized as follows:

(1) **OS-CNN** and **MOS-CNN**[10]: One-dimensional convolutional neural networks covered the receptive field of all scales, which are the latest and best deep learning-based methods achieved the highest accuracy for time series classification.

(2) **ShapeNet**[1]: The latest shapelet classifier that embeds shapelet candidates with different lengths into a unified space.

(3) **TapNet**[20]: A novel model that combines the benefits of traditional and deep learning, which designs a framework containing a LSTM layer, stacked CNN layer, and attentional prototype network.

(4) **WEASEL+MUSE**[34]: The most effective bag-of-patterns algorithm that builds a multivariate feature vector.

(5) **WLSTM-FCN**[12]: A famous deep-learning framework obtained the representations by augmenting LSTM-FCN with squeeze-and-excitation block.

(6) **ED-1NN**[10]: One of the most popular baselines based on Euclidean Distance and the nearest neighbor classifier.

(7) **DTW-1NN-I**[10]: One of the most commonly used baselines that process each dimension independently by dynamic time warping with the nearest neighbor classifier.

(8) **DTW-1NN-D**[10]: Another similar baselines that process all dimensions simultaneously.

**Implementation details.** In our model, the number of dynamic graphs for MTS is 4, the \(k\) value for top-\(k\) is set to 3 and the pooled ratio is 0.2. There are 3 layers of temporal convolution, and the convolution kernel size is 11,3,3. The channel size of temporal convolution is 64,128,256. The batch size is set to
16, and the learning rate is set to \(10^{-4}\). We tune the kernel size for a few datasets due to the large differences in the dimension and length of each dataset. All the experiments are implemented on Pytorch 1.11.0 in Python 3.9.12 and trained with 2,000 epochs (computing infrastructure: Ubuntu 18.04 operating system, GPU NVIDIA GA102GL RTX A6000 with 48 Gb GRAM)2.

Footnote 2: The source code is available at [https://github.com/linux1011/TodayNet](https://github.com/linux1011/TodayNet)

**Evaluation metrics.** We evaluate the performance of multiple classifiers over multiple test datasets by computing the accuracy, average accuracy, and the number of Wins/Draws/Losses. In addition, we also construct an adaptation of the critical difference diagrams [35], replacing the posthoc Nemenyi test with the pairwise Wilcoxon signed-rank tests, and cliques formed using the Holm correction recommended [36, 37].

### _Hyperparameter Stability_

We conducted experiments on the 12 randomly selected datasets of the UEA benchmark by changing the number of dynamic graphs \(n_{G}\), pooled ratio \(\eta\), and learning rate \(lr\) to evaluate the hyperparameter stability of TodyNet. Noteworthy, the number of dynamic graphs is corresponding to the number of slicing time series. _AWR_, _AF_, _BM_, _CR_, _ER_, _FM_, _HMD_, _HB_, _NATO_, _SRS1_, _SRS2_, and _SWJ_ are chosen as the datasets for the experiments in this section. In Figure 4, the standard boxplots show the average classification accuracies of all datasets with respect to changes in \(n_{G}:\{2,4,6,8,10,12,14,16\}\), \(\eta:\{0.5,0.1,0.15,0.2,0.25,0.3,0.5\}\) and \(lr:\{10^{-1},10^{-2},10^{-3},10^{-4},10^{-5}\}\). Note that the blue curve in the figure is the average accuracy of TodyNet over the selected 12 datasets with respect to the variation of parameters.

Overall, the performance of the model remains at a high level. Apparently, the average accuracy tends to fluctuate slightly with the increase of \(n_{G}\) due to a coarse-grained approach that these datasets with large length differences are split into the same number of time slots. However, in terms of overall performance, the implicit dependencies extracted by TodyNet are very effective for the time series classification task. It is obvious that the performance of the model first grows and then decreases to varying degrees with the changes of \(\eta\), which is because the pooling structure will be flat if we reduce too many or very few nodes at one layer of our pooling approach. In addition, the results show that a suitable value of \(lr\) is beneficial to obtain higher classification accuracy. Thus, we set appropriate parameters for different datasets to achieve the best performance of the model.

### _Classification Performance Evaluation_

To validate the performance of TodyNet, we compared the proposed TodyNet with baselines on all benchmark datasets in Table II, and the major results are shown in Table II. The specific accuracies of the baselines all refer to the original papers or [10]. The result marked with "N/A" means that the corresponding method is unable to obtain the result due to memory or computational restriction. The best and second-best results are highlighted in bold and underlined, respectively.

Table II indicates that TodyNet achieves the highest classification accuracy on 13 datasets. In terms of average accuracy, TodyNet shows the best performance and stability of 0.726 compared with the state-of-the-art baselines. For the comparisons of the 1-to-1-Wins/Draws/Losses, TodyNet performs much better than all the baselines. In particular, compared to state-of-the-art methods, the dynamic graph mechanism of TodyNet has a significant improvement for some datasets, such as _FD_, _FM_, _HMD_, etc. Excitingly, these datasets belong to the type of "EEG" which is recorded from magnetoencephalography (MEG) and contains the tags of human behavior. It is easy to see that the hidden dependencies between brain signals at different locations jointly determine human behavior, and TodyNet is able to capture such spatio-temporal features well and shows great potential. Simultaneously, it indicates that the dynamic characteristics of time series also positively influence the results of the classification.

On the other hand, we also conducted the Wilcoxon signed-rank test to evaluate the performances of all approaches. Figure 5 shows the critical difference diagram with \(\alpha=0.05\) which is plotted according to the results in Table II. The values in Figure 5 also reflect the average performance rank

Fig. 4: Boxplot showing the accuracies on 12 UEA datasets vs. changes in the number of graphs \(n_{G}\), pool ratio \(\eta\), and learning rate.

Fig. 5: Critical difference diagram on the 26 UEA datasets with \(\alpha=0.05\).
of the classifiers. TodayNet achieves the best overall average rank of 3.2692, which is lower than the ranks of the existing state-of-the-art deep learning-based approaches, such as MOS-CNN, WEASEL+MUSE, and TapNet. Besides, TodayNet is significantly better than other classifiers, e.g., ShapeNet, MLSTM-FCN, and DTW. This is because the extraction of hidden dynamic dependencies can significantly improve the performance of classification.

### _Ablation Study_

In order to validate the effectiveness of the key components that contribute to the improved outcomes of TodayNet, we employ ablation studies on the 26 UEA multivariate time series archive. We denote TodyNet without different components as follows:

* **w/o Graph**: TodyNet without temporal graph and graph neural networks. We pass the outputs of the temporal convolution to the output layer directly.
* **w/o DyGraph**: TodyNet without the temporal dynamic graph. We only construct one static graph as one of the inputs of graph neural networks by using the mentioned graph construction method and do not slice the time series.
* **w/o GPool**: TodyNet without the temporal graph pooling. We directly concatenate the outputs of the graph neural networks and pass them to the output module.

The scatter plots are shown in Figure 6 that demonstrate the

Fig. 6: Scatter plot for TodyNet, TodyNet without graph mechanism, dynamic graphs, and TodyNet without temporal graph pooling on the 26 UEA MTSC problems.
experimental comparison results of reducing different components of TodyNet. The horizontal and vertical coordinates of Figure 6 indicate the classification accuracy, and the points falling in the pale turquoise region indicate that ToyNet is more accurate on the corresponding dataset.

From Figure 6, a conclusion can be drawn from the results that the graph information significantly improves the outcomes of convolution-based classifier relying on the excellent capability of TodyNet to capture the hidden dependencies among variables and dynamic associations between different time slots. We can also observe that the introduction of a dynamic graph mechanism can obtain better model performance than a static graph because it enables information to flow between isolated but interdependent time slots. In addition, the effect of temporal graph pooling is evident as well: it validates that temporal graph pooling helps aggregate hub data in a hierarchical way which enhances the performance of graph neural networks to a great extent. In a word, all results of ablation experiments manifest that the proposed components of TodyNet are all indeed effective for the multivariate time series classification tasks.

### _Inspection of Class Prototype_

In this experiment, we show the effectiveness of our well-trained time series embedding by visualizing the class prototype and its corresponding time series embedding. To begin with, we analyze the representation learned by TodyNet over epochs with a heatmap. The _SWJ_ is a dataset of UEA archive that records short-duration ECG signals of 4 pairs of electrodes from a healthy male performing 3 different physical activities: Standing, Walking, and Single Jump. We randomly selected 3 samples which are individually corresponding to one category from 15 test samples of _SWJ_ for heatmap visualization. In Figure 7, each row of subplots shows the original signal of all sensors and the learned embedding from each sample under the corresponding class, respectively. The outcomes indicate that there are significant differences in the embeddings learned from different categories. Thus, an obvious conclusion is that TodyNet can clearly distinguish the classes of different samples of time series by learning efficient representations.

To further demonstrate the ability of TodyNet to represent time series, we use the t-SNE algorithm [38] to embed the representation into the form of a two-dimensional image for visualization. Figure 8 shows the results on test datasets of _HB_, _HMD_, and _NATO_. For convenience, all class labels are unified by Arabic numerals. As shown in Figure 8, each row denotes different datasets, and each column represents the visualization of the original data and the embeddings learned by TodyNet, respectively. It is clear that the distance between different samples from the same class is closer, which implies that TodyNet can effectively characterize class prototypes and enables highly accurate classification for different data.

## VI Conclusion

In this paper, a novel framework named temporal dynamic graph neural network was proposed. To the best of our knowledge, this is the first dynamic graph-based deep learning method to address multivariate time series classification problems. We propose an effective method to extract the hidden dependencies among multiple time series and the temporal dynamic feature among different time slots. Meanwhile, a novel temporal graph pooling method is designed to overcome the flat of the graph neural network. Our method has shown superb performance compared with other state-of-the-art methods on

Fig. 8: The t-SNE visualization of the representation space for the datasets Heartbeat, HandMovementDirection, and NATOPS.

Fig. 7: Heatmap visualization of representations learned by TodyNet on the StandWalkJump
UEA benchmarks. For future directions, there are two possible ways. On the one hand, a better classification performance may be achieved by transplanting the other temporal convolution methods. On the other hand, reducing the complexity of temporal graph pooling can further improve the efficiency of the model.
