0
$\begingroup$

for my supervised classification problem,

I have a train dataset which contains past purchase data of customers and 5 new products are purchased by these customers. I have a test dataset which contains past purchase data of customers. They never bought from these 5 products.

I want to train a predictive model, I need to convert integer purchased data and new products. There are so many different products in my purchased data.

my train dataset

my test dataset

I saw that the mapping was made for true-false to convert 1-0, but in this case what can I do that?

$\endgroup$
0
$\begingroup$

You cannot convert your string product names to integers and expect it to work, if you convert it to integers the algorithm you use will expect a linear relationship between these integers, a relationship that in fact does not exist.

It is categorical data, and you should treat it like that, you have to one-hot encode it. If you have too many products to one-hot encode all of them try grouping them in categories and then one-hot encoding the categories.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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