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.


1 Answer 1


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

  2. https://aboveintelligent.com/time-series-analysis-using-recurrent-neural-networks-lstm-33817fa4c47a

  3. https://machinelearningmastery.com/time-series-prediction-lstm-recurrent-neural-networks-python-keras/

Keywords to search: Time series classification tensorflow keras

  • $\begingroup$ Thank you for the comprehensive reply. I'll investigate Keras and the links and report back. $\endgroup$ Feb 5, 2018 at 17:05
  • $\begingroup$ Happy coding! Also, if you find this answer useful, please accept it. $\endgroup$ Feb 5, 2018 at 18:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.