I have a categorical feature called Type, which contains only 2 values. Salon or Circuit. Should I replace these values by 0 and 1 indicating Salon and Circuit or should I create 2 extra columns called Salon and Circuit which will have corresponding values as 0 or 1, which approach is better for accuracy of the model
A machine learning model can't process text. So you need to convert all your features having string values into numerical values.
In your case, there are only 2 distinct values in the Type column and hence you can convert this column to have values 0 and 1 (this is called Label Encoding).
If your feature had more than 2 classes (let's say 3 for example), then you would have to perform one-hot ending, which is creating different columns for each unique value in the feature
Comments
0 comments
Article is closed for comments.