0
$\begingroup$

I have data set with date features like 01/01/2019 and I would like to use KNN. However, I cannot find a good transformation for dates that has a meaningful distance result for the last feature.

For example:

f1 | 1 | 2 | 3 | 4 | 01/01/2019

f2 | 10 | 3 | 12 | 1 | 14/01/2019

Does anyone have any recommendations?

$\endgroup$
0
$\begingroup$

What do you consider a meaningful distance? One possibility would be days since some reference date.

If seasonality also matters, you could additionally (or also) have calendar date or some sine or cosine functions with period 1 year/n for integer n - the idea being to get a periodic spline. The same kind of idea (or flagging weekday vs. weekend etc.) could apply to day of the week, if that makes sense for your problem.

|improve this answer|||||
$\endgroup$

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