I try to use the code bellowm I use python 2, the link of the whole code is here https://www.kaggle.com/code/manthansolanki/image-classification-with-mnist-dataset/notebook
preds = model.predict_classes(x)
prob = model.predict_proba(x)
print('Predicted value is ',preds[0])
print('Probability across all numbers :', prob)
The error is
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-19-f1e0f362b2e9> in <module>()
----> 1 preds = model.predict_classes(x)
2 prob = model.predict_proba(x)
3
4
5 print('Predicted value is ',preds[0])
/home/.local/lib/python2.7/site-packages/keras/engine/sequential.pyc in predict_classes(self, x, batch_size, verbose)
265 A numpy array of class predictions.
266 """
--> 267 proba = self.predict(x, batch_size=batch_size, verbose=verbose)
268 if proba.shape[-1] > 1:
269 return proba.argmax(axis=-1)
/home/.local/lib/python2.7/site-packages/keras/engine/training.pyc in predict(self, x, batch_size, verbose, steps)
1147 'argument.')
1148 # Validate user data.
-> 1149 x, _, _ = self._standardize_user_data(x)
1150 if self.stateful:
1151 if x[0].shape[0] > batch_size and x[0].shape[0] % batch_size != 0:
/home/.local/lib/python2.7/site-packages/keras/engine/training.pyc 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:
/home/.local/lib/python2.7/site-packages/keras/engine/training_utils.pyc 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_1_input to have shape (784,) but got array with shape (307200,)