Human Activity Recognition example using TensorFlow on smartphone sensors dataset and an LSTM RNN. Classifying the type of movement amongst six activity categories - Guillaume Chevalier
First, thank you very much for your code. It has helped me out a lot.
I tried to change n_classes to 2, as I am only classifying between two states. However, I receive an IndexError whenever I reduce n_classes below 6. The error message is below:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-15-581f85d3f7ff> in <module>()
43 feed_dict={
44 x: X_test,
---> 45 y: one_hot(y_test)
46 }
47 )
<ipython-input-13-7d65b978d73d> in one_hot(y_, n_classes)
50 # Function to encode output labels from number indexes
51 y_ = y_.reshape(len(y_))
---> 52 return np.eye(n_classes)[np.array(y_, dtype=np.int32)] # Returns FLOATS
IndexError: index 2 is out of bounds for axis 0 with size 2
I'm not sure if I'm just misunderstanding what n_classes is supposed to represent or if there is a bug when it is reduced below 6 (any number I set it to that is greater than 6 still works).
I seem to have fixed the problem by changing the labels of my classes to 0 and 1 instead of 1 and 2, as the y hot was adding a third column with labels of 1 and 2.
Hello,
First, thank you very much for your code. It has helped me out a lot.
I tried to change n_classes to 2, as I am only classifying between two states. However, I receive an IndexError whenever I reduce n_classes below 6. The error message is below:
I'm not sure if I'm just misunderstanding what n_classes is supposed to represent or if there is a bug when it is reduced below 6 (any number I set it to that is greater than 6 still works).
My data has the shape:
Where the sole feature in the y arrays are labelled either 1 or 2 for my two classes.
My hyperparameters are currently set to:
and the one_hot function that I'm using is a fix that you suggested in another issue
Any help with this is much appreciated.
Best, Sean