Keras AttributeError: 'list' object has no attribute 'ndim'

后端 未结 3 1383
名媛妹妹
名媛妹妹 2021-02-12 14:50

I\'m running a Keras neural network model in Jupyter Notebook (Python 3.6)

I get the following error

AttributeError: \'list\' object has no attrib

3条回答
  •  轮回少年
    2021-02-12 15:22

    I don't know the shape of your training data but I suspect that you have an error on your input_dim. Try changing it to input_dim=len(X_data) like this:

    model  = Sequential()
    model.add(Dense(5, input_dim=len(X_data), activation='sigmoid' ))
    model.add(Dense(1, activation = 'sigmoid'))
    model.compile(loss='mean_squared_error', optimizer='adam', metrics=['acc'])
    model.fit(X_data, y_data, epochs=20, batch_size=10)
    

提交回复
热议问题