Error when checking model input: expected lstm_1_input to have 3 dimensions, but got array with shape (339732, 29)

前端 未结 3 870
自闭症患者
自闭症患者 2020-11-29 06:08

My input is simply a csv file with 339732 rows and two columns :

  • the first being 29 feature values, i.e. X
  • the second being a binary label value, i.e.
3条回答
  •  抹茶落季
    2020-11-29 06:14

    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!

提交回复
热议问题