I'm using 'NbClust' package to help me to get the "optimal number of clusters" and I noticed in my dataset I have attributes with different importance.

I have 5 attributes: x1,x2,x3,x4,x5 and I know that the attributes x5 must have the same value in a cluster and the attribute X4 have more importance than X1 and X3.

I'm using Euclidean distance and I normalized the data in order to have values between 0 and 1. I'm also using "One-Hot Encode Data" method in attributes x4 and x5

What should I do in these situations? How can I give more importance to specific attributes?



closed as unclear what you're asking by Michael Chernick, mkt, COOLSerdash, Peter Flom Apr 19 at 11:14

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ How do you know these things? $\endgroup$ – Peter Flom Apr 19 at 11:13

To increase the weight of attributes, scale them.

It's easy to see that with Euclidean distance this increases the importance of attributes.

But there is no "right" way of scaling the data. Squeezing everything to [0;1] is usually almost as bad as not scaling though.


We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • $\begingroup$ What scale do you suggest? Make sense to scale x1,x2,x3 to [0,1] and x4 and x5 to [1,2]? Thanks @Anony-Mousse $\endgroup$ – Marcus Apr 18 at 11:41
  • $\begingroup$ Obviously scaling to [1;2] is equivalent to scaling to [0;1]. So it must not make a difference. Weight attributes as you consider it meaningful for your problem. $\endgroup$ – Anony-Mousse Apr 18 at 17:47

Fact is that there doesn't exist any good "push button" solution to cluster analysis. It is an explorative technique, meaning that you have to try different methods and parameters and analyze the result.

The reason is that in many applications you can choose these values intuitively if you have understood your data well enough. E.g. when working with Geo data, distance is literatlly in kilometers, and it allows me to intuitively specify the spatial resolution. Similarly, minpts gives me an intuitive control over how "significant" a subset of observations needs to be before it becomes a cluster.

And in the end go and try out stuff. It's data exploration, not "return(truth);". There is not "true" clustering. There are only "obvious", "useless" and "interesting" clusterings, and these qualities cannot be measured mathematically; they are subjective to the user.


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