Multi-variate time series classification using a simple CNN#

In this notebook, we use sktime to perform for multi-variate time series classification by deep learning.

[ ]:
import numpy as np
import seaborn as sns
from sklearn.model_selection import GridSearchCV

from sktime.classification.deep_learning.cnn import CNNClassifier
from sktime.datasets import load_basic_motions


Load a dataset#

The Basic Motions dataset, from, has time series in six dimensions.

[ ]:
X_train, y_train = load_basic_motions(split="train", return_X_y=True)
X_test, y_test = load_basic_motions(split="test", return_X_y=True)
print(type(X_train.iloc[1, 1]))
[ ]:
# The class labels

Train a deep neural network classifier#

Here we choose to use the CNN (convolutional neural network) classifier. Other classifiers provided by sktime-dl include MLP, ResNet, InceptionTime and MCDCNN (Multi Channel Deep Convolutional Neural Network)

[ ]:
network = CNNClassifier(n_epochs=50, verbose=True), y_train)
network.score(X_test, y_test)

Generated using nbsphinx. The Jupyter notebook can be found here.