Working with categorical values with one-hot encoding
Machine learning and statistics can be quite good at determining relationships between numbers. But what if you have a feature that is categorical and doesn't have a relationship? The definition of a categorical feature is when the variable is a label or category with discrete possibilities, such as colors , the animal kingdom, or cities.
One option when you have this type of data is to use use one-hot encoding. This is the process of converting a categorical value into a set of ones and zeroes so that the model can interpret them as independent, but not infer that there is a relationship between them. This also prevents the inference that some categories are superior or inferior.
You can see an example of what this looks like in the following figure. Say you are looking at sales data for bouncy balls and one of the features is the color. There are three colors – red, blue and green. This is represented as data...