1
$\begingroup$

I have a column in my dataset which contains both number and strings as the value. I want to encode the string variable so to use it for predicting. What is the best way to do this?

$\endgroup$

1 Answer 1

1
$\begingroup$

Encoding is a way to transform categories to numerical variables, there are a lot of techniques.

The best technique depends on what is the information you want to encode and what is the model that you are going to use. Some models benefit more of one techniques than others.

You should ask yourself the following questions to try to find the best solution: - Why do you have numerical and categorical values in a column? - Does it make sense to have them? - Which model am I using? - What is the best way to feed them to this model?

From the bit that I get I would reccomend that either you do target encoding with everything or that you split that feature into two. And then you do target encoding in the categorical and even in the numerical. Just check which works better.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.