After building up the mlp using
## building a mlp model
model=Sequential()
model.add(Dense(25,input_shape=(10,),activation='relu'))
model.add(Dense(100,input_shape=(10,),activation='relu'))
model.add(Dense(150,input_shape=(16,),activation='relu'))
model.add(Dense(10,input_shape=(10,),activation='softmax'))
model.compile(loss='categorical_crossentropy',
optimizer='Adam',metrics=['accuracy'])
When I'm trying to fit the model using:
model.fit(x_train, y_train, epochs=10,validation_data=(x_test,y_test))`
I'm getting this error:
ValueError Traceback (most recent call last) in 1 # Training the MLP on the 2D data ----> 2 model.fit(x_train, y_train, epochs=10,validation_data=(x_test,y_test))
~\anaconda\lib\site-packages\keras\engine\training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, **kwargs) 950 sample_weight=sample_weight, 951 class_weight=class_weight, --> 952 batch_size=batch_size) 953 # Prepare validation data. 954 do_validation = False
~\anaconda\lib\site-packages\keras\engine\training.py in _standardize_user_data(self, x, y, sample_weight, class_weight, check_array_lengths, batch_size) 749 feed_input_shapes, 750 check_batch_axis=False, # Don't enforce the batch size. --> 751 exception_prefix='input') 752 753 if y is not None:
~\anaconda\lib\site-packages\keras\engine\training_utils.py in standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix) 136 ': expected ' + names[i] + ' to have shape ' + 137 str(shape) + ' but got array with shape ' + --> 138 str(data_shape)) 139 return data 140
ValueError: Error when checking input: expected dense_29_input to have shape (10,) but got array with shape (3072,)
Can someone please help me find the mistake?