Trying to build a numbers-in numbers-out but I keep running into this problem

This has the solution to my problem, Tl;Dr: It’s hidden in a advanced option.

I keep on getting this error:

You are passing a target array of shape (32, 1) while using as loss `categorical_crossentropy`. `categorical_crossentropy` expects targets to be binary matrices (1s and 0s) of shape (samples, classes). If your targets are integer classes, you can convert them to the expected format via: ``` from keras.utils.np_utils import to_categorical y_binary = to_categorical(y_int) ``` Alternatively, you can use the loss function `sparse_categorical_crossentropy` instead, which does expect integer targets.

Regretfully I have no idea how to fix this, All the data-types are floats so I set them to numerical. (and they are being ingested correctly) At the moment I just have two dense layers, one with 100 nodes out and linear activation, the other with 1 node out and again linear activation.

The objective is to output a single float based off the input numbers. However I can’t even get it to start, let alone train.

If your output is 0 or 1, you should choose binary_crossentropy as the loss function under hyper parameters tab.

If output is a continuous variable, you can choose mean_squared_error (or any other loss function which are relevant for continuous output)

1 Like

So, the issue I was having was actually that I was not opening the “advanced options” initially. I have little to no idea what I’m actually doing and I’m just winging it. I found the option before this got approved.


Under Hyper Parameters, you toggle “advanced options” and then you switch the Loss Function to something like Mean Absolute Error, or Mean Absolute Percentage Error.