My dataset has around 20 features, one of which is colors(in string format). There are around 50 different colors. I have converted them to RGB, but now I want to encode the data in such a way that the values are relevant, because I will cluster the data on this feature later on. To do this, one-hot encoding proved ineffective. Suggestions?
One-hot encoding will give you a sparse matrix, Try LabelEncoding, before converting them into RGB that is.
Also, you could try breaking the RGB values into three features (R, G, B) and try that approach as well.
Hope this helps.
Depends on what the Colour means in your data. Example temperature can be colour from blue and red, in which case 1-hot won't work. But looks like colour is categorical in your data. In that case it depends on what you are using to classify the data, are you using a decision tree, or SVM etc. Cos in case of decision tree you don't have to do anything as it can take care of categorical data ( again depends on which implementation you use ). in case of other methods they have their own ways in which categorical data has to be handled.