If one of the features for my data set is a score that is categorical string like:
Score
X1c
X3a
X1a
X2b
X4
X1a
X1b
X4
Where X1a
is the weakest followed by X1b, X1c, X2a, X2b ...X4
with X4
being the strongest, how can I encode it to integers such that X1a
can be the lowest int and X4
be the highest int. I'm looking to use a random forest classifier. Also, the training set is a separate data set so this encoding should be maintained for new data sets.