0
$\begingroup$

I'm working with an online retail order dataset consisting on 3 columns: Client ID, month of purchase and Product ID (one-hot encoded). Something like this:

enter image description here

My objective is to use this dataset to train a Keras classification model. While this approach shows good results when using a very small sample of the dataset (e.g: 5-10 rows), the model does not converge when larger samples are used (e.g: 100-200 rows) or the full dataset (around 540k rows). This is my Python code:

model = Sequential()
model.add(Dense(units=64, activation='relu', input_dim=2))
model.add(Dense(units=saidas_units, activation='softmax'))
model.compile(loss='categorical_crossentropy',
              optimizer='sgd',
              metrics=['accuracy'])
model.fit(myInputs, myProducts,
      batch_size=10,
      epochs=2000,
      verbose=1,
      validation_data=(myInputs, myProducts))

Weirdly enough, in some cases even though the "loss" value is low and the "accuracy" value is high, the product predictions produced by the model are always the same, no matter the inputs (clientId/month).

$\endgroup$

1 Answer 1

0
$\begingroup$

Weirdly enough, in some cases even though the "loss" value is low and the "accuracy" value is high, the product predictions produced by the model are always the same, no matter the inputs (clientId/month).

I'm betting the model is learning the marginal probability of the positive class. That would likely mean your features have little information. Are you only using month and client ID to predict if a customer bought a product? Also, can you give me the number your model is predicting and the same mean of the outcome in the training data?

$\endgroup$
2
  • $\begingroup$ Yes, I'm using month and client ID to predict if a customer bought a product. The model is predicting the same product (e.g: hot-encoded 1 0 0) for any pair of inputs. $\endgroup$ Commented Jul 27, 2020 at 23:03
  • $\begingroup$ Yea, I heavily suspect its related to using client ID as a continuous feature. Client ID is actually a categorical variable, the data curator just happens to have made it a number. I think someone may be willing to argue that a deep enough net could handle this and learn the appropriate structure, but that is a moot point because you only have a single hidden layer. $\endgroup$ Commented Jul 27, 2020 at 23:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.