TensorFlow LSTM Model Low Accuracy

20 Views Asked by At

I have been working on this for the past 2 weeks and I can not figure it out. I have a base dataset with the shape of (300, 6000, 2) (instance, timestep, coordinate). I am training different models on small versions of that dataset (500, 1000, 1500 timesteps and so on). However when I train it on an LSTM architecture it returns a really bad validation score. I has returned a 98 constantly one time when I tested the 6000 timestep model one time but other than that it is really low. I know that the validation score can be much much better as I saw online. Also for some reason my lower time step models are only returning two classes even if there are three classes. How do I fix that?

Do I need a history buffer for LSTM multivariable classification? How would I do that? Should I normalize the data if this data is based on coordinate data? Do I need to fix my model or add anything? How do apply the solution to the small timestep models? My data really does not have any timeforcasting. How do I add that to a 3d numpy array?

Here is my model (currently using the same model for all):

model = Sequential([
    LSTM(10, input_shape=(6000, 2)), #imagine that 6000 being lower for other models (500, 1000, 1500)
    BatchNormalization(),
    Dense(64, activation='relu'),
    Dropout(0.5),
    Dense(units=3, activation="softmax")
])

callbacks = [
    ReduceLROnPlateau(monitor='val_loss', factor=0.1, patience=3, verbose=1),
    EarlyStopping(monitor='val_loss', patience=10, verbose=1)
]

model.compile(optimizer=Adam(learning_rate=0.01), loss='sparse_categorical_crossentropy', metrics=['precision'])

# Train the model
model.fit(X_train, y_train, epochs=15, validation_data=(X_test, y_test), callbacks = callbacks)

Here is my y_test:

[2., 2., 2., 2., 2., 2., 1., 0., 1., 2., 0., 1., 0., 1., 0., 2., 0., 0., 0., 2., 0., 0., 2., 0., 1., 1., 0., 2., 1., 2., 1., 1., 1., 0., 1., 0., 0., 0., 1., 1., 0., 0., 2., 2., 1., 1., 0., 0., 1., 0.]

I really need help with this and I really appreciate it.

Thanks!

What I tried is above

0

There are 0 best solutions below