0
$\begingroup$

I am building a neural network and one of the inputs is a unique customer number. There are about 200k customers and it is important that they are an input. What is the best way to prepare these as inputs in my model? Is 200k 1-of-C categorical inputs the best way to do it?

$\endgroup$
  • $\begingroup$ You haven't said what data you're fitting. Specifically, are you predicting something about customers, or about some other data for which the associated customer is a feature? $\endgroup$ – Sean Easter Nov 4 '15 at 4:24
  • $\begingroup$ Predicting sales by customer $\endgroup$ – Adam12344 Nov 4 '15 at 4:25
  • 1
    $\begingroup$ I would try to come up with some salient features to describe each customer. This information will contain some useful correlations opposed to one-hot encoding per custumer. The dimensionality will be also much lower. $\endgroup$ – Vladislavs Dovgalecs Nov 4 '15 at 5:23
  • 1
    $\begingroup$ 1 of c is a very bad idea, and won't work that well with a neural net (I assume you actually want to model interactions between user and product). I think you have to step back and explain what your goal is. This sounds like a recommendation system, why aren't you using standard approaches from that area? $\endgroup$ – seanv507 Nov 4 '15 at 7:04
2
$\begingroup$

You could do that, but I doubt your results would be useful unless you have a lot of training data to support your model. Details would help.

I might treat each customer as an entity that has one or more values. These may be seeded and/or inferred by other datasets, but for training purposes each value is a weight per customer. So you map your customer into maybe 5 continuous variables, not 24 dense binary ones or god forbid 200k sparse binary ones! This approach requires you somehow seed and tune each customer's state, of course.

$\endgroup$
1
$\begingroup$

Did you try decision trees or random forest? You can change all categories to the numbers and than apply them into the model. Using this approach you will have just 1 dimension for categories instead of 200k dimensions and that would be computationally cheaper. Probably your results would be worse, because numbers assume some kind of ordering in categories (decision tree should split those categories into a huge amount of leaves), but it could be a good starting point. In my experience random forest shows pretty good results in cases where some columns have huge amount of categories. Of course, It's not always work, but it's definitely better to try something simple instead of using NN with a huge number of connections.

It could be even simpler if you use only customer number in prediction model. You can try predict the average values using sales history related to that customer (that should be actual prediction for decision tree if you use just one categorical variable). At least it could be a good benchmark.

Also it's not a good practice to use all categories for testing first approaches. You can make a sample that contains maybe 1000 categories and then you can test different algorithm much faster and identify some typical problems for different approaches.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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