BillyJo_rambler
BillyJo_rambler

Reputation: 583

Feature order when used with a trained machine learning model

Say I have a machine learning algorithm trained using features F1, F2 and F3. This model is then subsequently picked and used on another project (imported using Joblib).

When using the trained model, do the inputs need to be in the same order (F1, F2 or F3)?

Upvotes: 0

Views: 912

Answers (2)

Jon Nordby
Jon Nordby

Reputation: 6259

Yes, they must be in exactly the same order. And preprocessed in exactly the same way.

Upvotes: 1

mujjiga
mujjiga

Reputation: 16856

For simplicity assume that you are fitting a linear model and a regression model (but generalizes to all the others). If F1, F2, F3 are your features then it finds the weights w1, w2, w3, bias such that the error made by w1*F1 + w2*F2 + w3*F3 + bias is minimum. It is called the linear combination of weight and features.

So when making the prediction the model calcualtes the value w1*F1 + w2*F2 + w3*F3 + bias so the order of features matter.

Upvotes: 2

Related Questions