Basic Time Series Classification Examples



I've been using matlab until now to classify a large number of labelled time series I have. This has been relatively successful but I'd like to try using Tensorflow to apply a Deep Learning paradigm instead.

I'm a complete noob at this and so I'm a bit overwhelmed with the literature as I'm struggling to generalise examples such as the 0-9 digits classification examples to my problem.

My current code reads in the 1064 time series (length 3125), reads in the labels, converts the labels to onehot_encoding and extracts training and validation sets.

#Not all code included
def read_data():
    #Get labels from the labels.txt file
    labels = pd.read_csv('labels.txt', header = None)
    labels = labels.values

    data = pd.read_csv('ts.txt',header = None)

    return data, labels

data, labels = read_data()

# Default split is 75% train 25% test
ts_train, ts_test, labels_train, labels_test = train_test_split(data,labels)

onehot_encoder = OneHotEncoder(sparse=False)
labels_train = onehot_encoder.fit_transform(labels_train)
labels_test = onehot_encoder.fit_transform(labels_test)

#Construct the graph
batch_size = 100
seq_len = 3125
learning_rate = 0.0001
epochs = 1000

But now I need to construct the graph and I'm a bit lost. If someone could link me some useful examples I'd be very grateful thank you.


Posted 2018-02-05T11:34:21.933

Reputation: 145

Question was closed 2018-02-17T05:56:06.530



What you need to learn are RNNs and LSTMs. Here are some links I used to learn these:

  1. CS231n RNN+LSTM lecture

  2. Understanding LSTMs

Also I would suggest you to use Keras, a Tensorflow API. In my experience, it makes working with RNNs and LSTMs way easier, if you're a beginner.

I found these articles which seemed related to your problem:

  1. Time series classification project by naveen sai on github



Keywords to search: Time series classification tensorflow keras

Gaurav Kumar

Posted 2018-02-05T11:34:21.933

Reputation: 304

Thank you for the comprehensive reply. I'll investigate Keras and the links and report back. – user1147964 – 2018-02-05T17:05:27.147

Happy coding! Also, if you find this answer useful, please accept it. – Gaurav Kumar – 2018-02-05T18:17:24.030