Skip to main content
Tweeted twitter.com/StackStats/status/1483454165552713731
edited tags; edited tags
Link
ttnphns
  • 58.8k
  • 53
  • 287
  • 512
added 1 character in body
Source Link
Adel
  • 295
  • 3
  • 10

I have asked a related question in mathematics section, but I think here is a better place to ask.

for both KNN algorithm (classification) and k-means algorithm (clustering), there is a need for a distance metric (like euclidean distance) to compute the distance between two instanceinstances. I know there is also other methods.

when our training data contains both numeric and categorical attributes, it is said we have to convert categorical attributes to numerical values. I know there is some methods like binary variables and target-based-encoding for this conversion.

lets say I have converted all categorical data to the numerical. how about other data which was numerical? should I normalize them?

imagine I have some numerical data with a large range (salary between 0 to 100,000) then if I have a binary variable (only contains 0 and 1), then the effect of this binary variable is too small and I think computing the euclidean distance is meaningless in this case.

My question is: Should I convert All data to binary variables or do something like normalization in order to have the same range for all attributes?

I have asked a related question in mathematics section, but I think here is a better place to ask.

for both KNN algorithm (classification) and k-means algorithm (clustering), there is a need for a distance metric (like euclidean distance) to compute the distance between two instance. I know there is also other methods.

when our training data contains both numeric and categorical attributes, it is said we have to convert categorical attributes to numerical values. I know there is some methods like binary variables and target-based-encoding for this conversion.

lets say I have converted all categorical data to the numerical. how about other data which was numerical? should I normalize them?

imagine I have some numerical data with a large range (salary between 0 to 100,000) then if I have a binary variable (only contains 0 and 1), then the effect of this binary variable is too small and I think computing the euclidean distance is meaningless in this case.

My question is: Should I convert All data to binary variables or do something like normalization in order to have the same range for all attributes?

I have asked a related question in mathematics section, but I think here is a better place to ask.

for both KNN algorithm (classification) and k-means algorithm (clustering), there is a need for a distance metric (like euclidean distance) to compute the distance between two instances. I know there is also other methods.

when our training data contains both numeric and categorical attributes, it is said we have to convert categorical attributes to numerical values. I know there is some methods like binary variables and target-based-encoding for this conversion.

lets say I have converted all categorical data to the numerical. how about other data which was numerical? should I normalize them?

imagine I have some numerical data with a large range (salary between 0 to 100,000) then if I have a binary variable (only contains 0 and 1), then the effect of this binary variable is too small and I think computing the euclidean distance is meaningless in this case.

My question is: Should I convert All data to binary variables or do something like normalization in order to have the same range for all attributes?

Source Link
Adel
  • 295
  • 3
  • 10

Distance metric for categorical and numerical data

I have asked a related question in mathematics section, but I think here is a better place to ask.

for both KNN algorithm (classification) and k-means algorithm (clustering), there is a need for a distance metric (like euclidean distance) to compute the distance between two instance. I know there is also other methods.

when our training data contains both numeric and categorical attributes, it is said we have to convert categorical attributes to numerical values. I know there is some methods like binary variables and target-based-encoding for this conversion.

lets say I have converted all categorical data to the numerical. how about other data which was numerical? should I normalize them?

imagine I have some numerical data with a large range (salary between 0 to 100,000) then if I have a binary variable (only contains 0 and 1), then the effect of this binary variable is too small and I think computing the euclidean distance is meaningless in this case.

My question is: Should I convert All data to binary variables or do something like normalization in order to have the same range for all attributes?