# Categorical data preprocessing for training a algorithm

I have a training dataset where values of "Output" col is dependent on three columns (which are categorical [No ordering]).

Inp1    Inp2        Inp3               Output
A,B,C   AI,UI,JI    Apple,Bat,Dog      Animals
L,M,N   LI,DO,LI    Lawn, Moon, Noon   Noun
X,Y,Z   LI,AI,UI    Xmas,Yemen,Zombie  Extras


So, based on this training data, I need a ML Algorithm to predict any incoming data row such that if it is Similar to training rows highest similar output aassigned.

The rows can go on increasing (hence get_dummies is creating a lot of columns, using those is not feasible), also the there's no ordering as per priority. Which encoding for Inp columns Categorical data will be needed for a ML model to work. Please suggest a better way to model the same.

• Not clear what you are asking. Can you supply a sample incoming data row and demonstrate why it might be similar or not similar to what you have shown? Apr 29, 2022 at 21:15
• The dataset similarity is not clearly known, training dataset would therefore be modelled such that incoming rows would predict the class based on training data. I wanted to know a better way to encode this type of categorical data and apply a ML model.
– spd
Apr 30, 2022 at 4:12