Reputation: 85
I have tried to build LSTM model with this sample of dataset
(patient number, time in mill/sec., normalization of X Y and Z, kurtosis, skewness, pitch, roll and yaw, label) respectively.
1,15,-0.248010047716,0.00378335508419,-0.0152548459993,-86.3738760481,0.872322164158,-3.51314800063,0
1,31,-0.248010047716,0.00378335508419,-0.0152548459993,-86.3738760481,0.872322164158,-3.51314800063,0
1,46,-0.267422664673,0.0051143782875,-0.0191247001961,-85.7662354031,1.0928406847,-4.08015176908,0
1,62,-0.267422664673,0.0051143782875,-0.0191247001961,-85.7662354031,1.0928406847,-4.08015176908,0
and this what i have done with the code
np.random.seed(7)
train = np.loadtxt("featwithsignalsTRAIN.txt", delimiter=",")
test = np.loadtxt("featwithsignalsTEST.txt", delimiter=",")
x_train = train[:,[2,3,4,5,6,7]]
x_test = test[:,[2,3,4,5,6,7]]
y_train = train[:,8]
y_test = test[:,8]
x_train = x_train.reshape((-1,1,6))
model = Sequential()
model.add(LSTM(64,activation='relu',input_shape=(1, 6)))
model.add(Dense(1, activation='softmax'))
model.compile(loss='binary_crossentropy',
optimizer='adam',
metrics=['accuracy'])
model.fit(x_train, y_train, batch_size = 128, epochs = 10, verbose = 2)
there is no error but the accuracy is very low and the loss is very high
Epoch 1/20 - 63s - loss: 15.0343 - acc: 0.0570 Epoch 2/20 - 60s - loss: 15.0343 - acc: 0.0570 Epoch 3/20 - 60s - loss: 15.0343 - acc: 0.0570 Epoch 4/20 - 60s - loss: 15.0343 - acc: 0.0570
Upvotes: 0
Views: 766
Reputation: 85
the wrong here is the use of the softmax activation function,, because it is used for categorical problems.. but this is a binary problem so the best activation function is the sigmoid
Upvotes: 1