# Timestamp sequence classification

I am trying to classify a series of timestamps using RNN with LSTM. The data consists of timing information extracted from the uplink packets recorded during a website fetch. The dataset contains 100 individual fetch samples of each website in a set of 100 websites, this gives me 10,000 samples.

I would like to teach a neural network to classify sequences of timestamps to which website they belong.

An example sequence would look like:

0.0, 0.25420099, 0.70250899, 0.7434534, 0.8746745, ... 2.54634634


Each of these values represents an offset from the start of the website fetch.

These all differ in lengths and are between ~300 and ~4500 timestamps.

I have tried training the LSTM network in Keras like below:

modelClass = Sequential()
modelClass.add(LSTM(100))
modelClass.add(Dense(1, activation='sigmoid'))
modelClass.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
modelClass.fit(X_tr, y_tr, epochs=3, batch_size=64)
print(modelClass.summary())
scores = modelClass.evaluate(X_tst, y_tst, verbose=0)
print("Accuracy: %.2f%%" % (scores[1]*100))


Training data is in the shape of (9000, maximum_sequence_length, 1), however this gave me very bad results. I am new to machine learning and don't fully understand how to find appropriate algorithms for specific tasks. Google searches did not come up with any ways to classify such data.

I would appreciate any suggestions and directions, please let me know if more information is required.

• Possible duplicate of How to classify and cluster this time series data – aberger Jul 22 at 17:44
• Did you triy using the K-NN algorithm available in scikit package? I did multiple times of classification using it. – Rashid Quamar Aug 4 at 6:56
• @RashidQuamar thanks for the suggestion, the original solution was to use k-NN and it worked fine, however, it required a costly distance function and I wanted to see how a neural network would perform on this problem. I ended up using a 4 layer convolutional neural network. It seemed to be performing quite good, but I could not verify whether it recognizes the sequences correctly, or just by learning their lengths. – Hryniu Sep 12 at 10:02