I have a dataset which lists the amount of seconds a user held a session by browser_type. For example:

user 1|iPhone-safari|50 seconds
user 1|PC-safari|400 seconds
user 2|android-unknown|5 seconds

There are around 100 different levels of this (it is detailed) and I wanted to check the optimal way of entering this information into my neural-network.

As far as I understand: it is better to give as much information as possible and let the neural-network decide what function form to impose on the data:

  • For example if I pick out the browser that the user spent the most amount of time in (so associate just one value with each other), then I imposing my assumption that that is what matters (perhaps the top 2 matter more, or the 3rd, etc)

  • If collapse the level of aggregation (for example all iPhones get lumped together, all PCs, etc) then again I am the one deciding what information is more important and that is best handled by the neural-network

  • If encode the 'duration in seconds' as a binary (yes/no) then I am limiting the information to the neural-network again and imposing my own assumption which is not based on the training data.

This leads me to believe that the best way to put this data into my NN is to create 100 columns which contain the number of seconds the user spent in the browser (others = 0 seconds).


Is that correct? Or is that not fair to ask without saying that I am have around 250,000 observations to train on? OR would the proper approach be to use ALL the attributes and then throw in the attributes aggregated at various levels and use PCA to decide which to use?

  • $\begingroup$ And what do you try to predict? $\endgroup$ – Piotr Migdal Feb 9 '16 at 14:30
  • $\begingroup$ For example whether they ended up buying product A, B or C $\endgroup$ – mptevsion Feb 9 '16 at 14:49

There is no universal way how to transform data. As always, train your classifier, test in and see which representation gives the highest test scores.

Especially for such sparse data 100 columns is not that much, so I would go with listing time for each possibility (if it turn out that some weights are similar - you will get it from data, rather that imposing it by hand).

No, don't do PCA beforehand (what is your intend here?), unless for exploration. But try running logistic regression, perhaps with LASSO regularization (in this problem starting from NN is bizarre). What may be crucial is appropriate scaling of each length (e.g. Box-Cox transform for each variable).


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.