How to I use the existing ML model to predict for new data value?

412 Views Asked by At

I have built a machine learning model using 34 features. Now I want to check how well the model predicts the new data value. However, initially there were 26 features but one-hot and label encoding made it upto 34 features. So if I give an input data value of 26 features, how will it perform one-hot encoding and label encoding to covert it into 34 features and then predicting the result?

I want to give an input of 26 features and it will give me an output after performing all necessary steps.

1

There are 1 best solutions below

0
Nikaido On

You should follow the preprocess and feature engineering that lead to that said 34 features

When you built the model there was a step in which you have done the preprocess and feature engineering

X # your data
X = preprocess_data(X)
X = feature_engineering_data(X) # 26 dim to 34 dim
model.fit(X, y)
new_data = preprocess_data(new_data)
new_data = feature_engineering_data(new_data)
model.predict(new_data)