Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sklearn: Categorical Imputer?

Is there a way to impute categorical values using a sklearn.preprocessing object? I would like to ultimatly create a preprocessing object which I can apply to new data and have it transformed the same way as old data.

I am looking for a way to do it so that I can use it this way.

like image 418
user1367204 Avatar asked Oct 20 '25 02:10

user1367204


1 Answers

Yes, it is possible. For example, you can use sklearn.preprocessing.Imputer with parameter strategy = 'most_frequent'.

Use fit_transform method to apply it to old data (train set) and then transform on new data (test set).

like image 167
slonopotam Avatar answered Oct 22 '25 03:10

slonopotam