Setting timesteps = 1
(since, I want one timestep for each instance) and reshaping the X_train and X_test as:
import numpy as np
X_train = np.reshape(X_train, (X_train.shape[0], 1, X_train.shape[1]))
X_test = np.reshape(X_test, (X_test.shape[0], 1, X_test.shape[1]))
This worked!
More Related Contents:
- ValueError: Input 0 is incompatible with layer lstm_13: expected ndim=3, found ndim=4
- Understanding Keras LSTMs
- Tensorflow – ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float)
- Proper way to feed time-series data to stateful LSTM?
- TensorFlow: Remember LSTM state for next batch (stateful LSTM)
- Neural Network LSTM input shape from dataframe
- expected ndim=3, found ndim=2
- Passing output of a CNN to BILSTM
- Keras LSTM input dimension setting
- How to visualize RNN/LSTM gradients in Keras/TensorFlow?
- ValueError: invalid literal for int() with base 10: ”
- TensorFlow Only running on 1/32 of the Training data provided [duplicate]
- How to export Keras .h5 to tensorflow .pb?
- Keras + Tensorflow and Multiprocessing in Python
- Keras Sequential model input layer
- How to concatenate two layers in keras?
- Does Any one got “AttributeError: ‘str’ object has no attribute ‘decode’ ” , while Loading a Keras Saved Model
- How does Keras 1d convolution layer work with word embeddings – text classification problem? (Filters, kernel size, and all hyperparameter)
- ValueError at /image/ Tensor Tensor(“activation_5/Softmax:0”, shape=(?, 4), dtype=float32) is not an element of this graph
- ValueError: Error when checking target: expected model_2 to have shape (None, 252, 252, 1) but got array with shape (300, 128, 128, 3)
- What do I need K.clear_session() and del model for (Keras with Tensorflow-gpu)?
- Why can’t I get reproducible results in Keras even though I set the random seeds?
- AttributeError: module ‘tensorflow.python.keras.utils.generic_utils’ has no attribute ‘populate_dict_with_module_objects’
- memory issues when transforming np.array using to_categorical
- What is the role of TimeDistributed layer in Keras?
- What does “ValueError: object too deep for desired array” mean and how to fix it?
- Keras AttributeError: ‘Sequential’ object has no attribute ‘predict_classes’
- Is Keras thread safe?
- Keras, how do I predict after I trained a model?
- How to add an attention mechanism in keras?