1
$\begingroup$

I have dataset consisting of house prices for example. The dataset contains features such as: house size, monthly rent, house colour, location, year the house was built.

I wanted to group these all attributes into clusters. The problem is how to represent the categorical features, such as colour. And how does the clustering algorithm work with these categorical variables?

Another question is: what happens if let’s say monthly rent 0, how does this affect clustering?

$\endgroup$
1
  • $\begingroup$ Can anyone explain what happens if attributes and numbers are mixed. How grouping works practically not one hot encoding $\endgroup$
    – user102751
    Aug 3, 2020 at 16:41

1 Answer 1

1
$\begingroup$

thank you for your question, which asks about how to represent categorical variables in clustering.

The main way that we represent any categorical variable is to represent them as one-hot encodings (https://machinelearningmastery.com/why-one-hot-encode-data-in-machine-learning/).

After converting our categorical variables to one-hot encodings, we simply concatenate these vectors with our numerical values (which should be normalised!) to make a long / high-dimensional vector for a particular example in your dataset.

$\endgroup$
1
  • $\begingroup$ Can you explain how grouping works incase of categorical and numbers. I do understand implementing algorithm python wise. But unable to understand practically clustering. How grouping works which is basis. It helps me. A lot if u can explain me this tha ks $\endgroup$
    – user102751
    Aug 3, 2020 at 17:02

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.