1
$\begingroup$

I have the following categorical feature in a data table (recording the day of week when a certain action happened):

ID | DAY_OF_WEEK
---+-------------
01 | MON
01 | TUE
02 | MON
01 | MON
01 | WED
02 | SAT
02 | SUN

I have turned these into different columns according to days of week and proportion (percent) of events happening that days respectively per ID:

ID | MON_% | TUE_% | WED% | THU_% | FRI_% | SAT_% | SUN_%
---+-------+-------+------+-------+-------+-------+------
01 | 0.50  | 0.25  | 0.25 | 0.0   | 0.0   | 0.0   | 0.0
02 | 0.33  | 0.0   | 0.0  | 0.0   | 0.0   | 0.33  | 0.33

Now, my question is if the latter resulted encoding matters as quasi one-hot encoded features or rather numerical features? This does matter because applying K-Means or computing (Euclidean) distances are invalid on OHE while valid on numerical features. I'm uncertain.

$\endgroup$
1
  • $\begingroup$ Every encoding is “numerical” because it uses numbers. It’s not one-hot, because it’d need to use only zeros and ones. Why does it matter? $\endgroup$
    – Tim
    Commented Jul 4, 2022 at 7:30

1 Answer 1

0
$\begingroup$

As the values per row add to one, you have histograms, which can be considered as numeric vectors.

From your mention of k-means, it can be concluded that you use these values for clustering and are thus looking for an appropriate distance measure. There are indeed special distance measures for histogram data. In your case it seems reasonable to take the distance of days into account, for which the "earth mover's distance" is a natural candidate distance.

$\endgroup$

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.