Data Science Asked on August 5, 2021
model=Sequential()
model.add(Dense(input_dim = 12, units = 10, activation='relu', kernel_initializer='uniform'))
model.add(Dense(units = 8, activation='relu', kernel_initializer='uniform'))
model.add(Dense(units = 1, activation='sigmoid', kernel_initializer='uniform'))
print('Training the model...')
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
while running the model.fit()
model.fit(X_train,y_train,batch_size=32, epochs=10, verbose=1)
I am getting the Error
ValueError: Error when checking input: expected dense_36_input to have shape (None, 12) but got array with shape (140, 2)
@Angel
The neural network will try to adjust to this input shape. In your case you have specified input_dim = 12 but in your data (140,2) there are only 2 features or columns.
Set input_dim =2
Reshape input array to in multiples of specified input dim i..e 12.
Note:: other valid input_dim for you can be 14 (reshape input to (20,14)), 10 (reshape input to (28,10))
Answered by shantanu pathak on August 5, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP