# Using categorical feature as both a continuous feature, and also doing One hot encoding. Is this overkill?

I am working on a Machine Learning regression problem, with a data-set where I have data from a period of several years. From the "date" feature, I extracted the week number (0-53). Next I am doing 2 things:

1) One hot encoding: Splitting this categorical "week number" feature into 53 binary features, where each feature indicates whether the data points belong to that particular week number or not.

2) I am also using the cyclic variable (week number) as a continuous variable to predict my outcome. First I am converting this feature, however, to the distance from week 1 (so week 2 and 53 don't represent drastically different time points)

My question is, am I making this too complicated without increasing potential improvements in my model outcome? Does including the continuous variable actually provide my model with valuable information that is not already covered in the categorical feature extraction? Thank you in advance

• My initial response would be to you a spline for the weekly trend. A simpler approach would be using a pair of Fourier terms to model the weekly periodicity (e.g. sin(2*pi*(1/52.15)*weekNumber) + cos(2*pi*(1/52.15)*weekNumber) ). Using both a 53-leveled factor as well as the week number in your model probably loses you way too many degrees of freedom. – usεr11852 Oct 14 '18 at 0:12
• Thanks for your suggestions. I understand the concern for losing too many degrees of freedom. I learned earlier, however, that losing degrees of freedom isn't the biggest issue if I have a large enough data-set. In this case, I have 17,000 data points and 120 features even after the one hot encoding, so I would say this is still a "skinny" dataset. Do you think losing degrees of freedom should still be a big concern for me? – stats_nerd Oct 14 '18 at 2:11