Error when checking target: expected dense_3 to have shape (3,) but got array with shape (1,)

The problem is with your label-data shape. In a multiclass problem you are predicting the probabibility of every possible class, so must provide label data in (N, m) shape, where N is the number of training examples, and m is the number of possible classes (3 in your case).

Keras expects y-data in (N, 3) shape, not (N,) as you’ve problably provided, that’s why it raises an error.

Use e.g. OneHotEncoder to convert your label data to one-hot encoded form.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)