#need help in creating a simple ml.model using keras
1 messages · Page 1 of 1 (latest)
From what I can make out, your architecture (sigmoid + cross-entropy) is geared towards a classification problem (expected output is true or false). This doesn't seem to be a classification problem, but rather a regression problem (expected output is a continuous number from 0.0 to 1.0).
Try replacing loss function with MSE (https://www.tensorflow.org/api_docs/python/tf/keras/metrics/mean_squared_error) and replace sigmoid with no activation (i.e. make last layer linear), so that the network can fit the data better.
Also, accuracy is inappropriate for classification problems 🙂 Just use MSE as your metric.
TensorFlow
Computes the mean squared error between labels and predictions.
other than that, first step is to focus on getting very low MSE in training to prove the architecture can solve the problem at all. Don't bother with validation, regularisation, generalisation etc. until you get that part sorted.
if you need further help, share what is in x_train and y_train.
i thought of
classifying it into
100 scores
100 neurons and the most with most score will become spending score
and I have alreasdy tried linear regression earliier and even thought I get a ver low loss still I get incorrect predictions
If your network has 100 outputs, then supply the same amount of target values (for each training example). I'm not sure how that loss works at all with 100 outputs but just 1 target.
I understand, but what about linear regression
why am I getting wrong predictinos in that too
I don't know, you didn't supply enough information 🙂 for linear regression, have one linear output, provide a single float y_train during training, and use MSE for loss.
I have only 200 rows
ah sorry, I'm saying per row. If you want regression, your network should have one output only, and then you have to provide a single float y_train for each training row. So in total, 200 values.
ah but you are using sparse_categorical_crossentropy, ok, then looks like one target should be enough. Haven't used that one before. Maybe follow what the guy in SO is saying.
@sharp pivot had a bit of a poke in the notebooks you posted on SO, and can't see any errors. The predictions are indeed pretty weak. It's possible there isn't any signal in this particular dataset, and it's just random junk 😄 May I ask where you got the dataset from?