#need help in creating a simple ml.model using keras

1 messages · Page 1 of 1 (latest)

sharp pivot
floral wedge
#

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.

#

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.

sharp pivot
#

classifying it into

#

100 scores

#

100 neurons and the most with most score will become spending score

sharp pivot
floral wedge
sharp pivot
#

why am I getting wrong predictinos in that too

floral wedge
#

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.

floral wedge
#

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.

floral wedge
#

@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?

floral wedge
#

try running df.corr(), it will show you correlation between columns

#

age seems the most correlated, but it's anything but:

plt.scatter(df['Age'], df['Spending Score (1-100)'])
plt.show()