0
$\begingroup$

So I have this dataset I need to perform several techniques on as part of a data mining/machine learning project of some sort in PYTHON. There are a couple of features however, that have me very worried as I don't know whether I whould handle them as Categorical (ordinal to be precise) or as numeric.

  1. The first feature takes integer values from 0 to 9 and it's supposed to represent population percentage of a certain religion (so 0 is 0%, 1 is 1-10%, 9 is 100%)
  2. The second feature represents contibution (money) and also takes values from 0-9 depending on how big the contribution is (so 0 is.. well, 0 , 1 is 1-49 , 9 is 20000+).

How should I handle these features? Are they interval data? Should I one-hot-encode them into dummies or should I leave them as they are now?

I am going to have to perform some clustering and classification techniques on the dataset. Thank you in advance!

$\endgroup$

1 Answer 1

3
$\begingroup$

They are not categorical as they have a meaningful ordering that you likely want to use. The first is usable as is as it is roughly fraction religious times 10. Yes it's ordinal but happens to be just a rescaled continuous feature.

The second is ordinal and so you don't quite want to use it as a continuous feature as that doesn't capture the difference in scale that they indicate. It might work OK, but you could also translate each number to the midpoint of corresponding range.

$\endgroup$
3
  • $\begingroup$ So, can I scale the 1st one along with other numeric features? The second has to be coded into dummies? I don't know.. there's actually more features with the 2nd one's characteristics and I could well end up with a LOT of dummies. $\endgroup$
    – NeR0
    Jun 22, 2020 at 20:17
  • $\begingroup$ It's reasonable to treat the first one as numeric. I'm not suggesting encode the second, but to translate it to some inferred actual continuous value according to the meaning of the feature, like the midpoint of its range $\endgroup$
    – Sean Owen
    Jun 24, 2020 at 1:57
  • $\begingroup$ Thank you Sean! Seems reasonable to me and it does seem to make a difference in the grand scheme of things. $\endgroup$
    – NeR0
    Jun 28, 2020 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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