I am not familiar with multi-class prediction so I apologize in advance if this questions seem very basic.

Here is my dataset: So within the dataset, I am trying to predict which fare product is picked by the customer, in which choice is the dependent variable

enter image description here

Columns 6:14 are prices of each option, and the last column shows which option the customer decides to take in the end.

The dataset has about ~160000 rows, so I am not sure for days to departure, week (day of week), and group (week number in a year), if I should encode them as factors or numerical variables. My fear is that if I encode week and group as factors, this will result in me having too many predictors and an incredibly long run time if I try to use multinom regression in caret. Does anyone have any suggestions as to how I should encode them? Thank you for the help in advance :(


1 Answer 1


Some thoughts:

  1. Another consideration is that these variables are ordered, so if you convert them to factors you will lose the ordering information, which may be important.
  2. The week and group are cyclic, so for the week variable, 6 is probably more similar to 0 than to 3, and for the group variable, 52 is probably more like 1 than 26. This is not captured by a single variable and one way to encode these is to create two variables for each, using sine and cosine encodings. For example, for group:
    1. Normalise the group to the range $[-\pi, \pi]$ to give $group_{norm}$.
    2. Create two new variables: $group\_sin = sin(group_{norm})$, $group\_cos = cos(group_{norm})$ and use these instead of the original group.

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.