# Model Deployment: export Scikit Learn Pipeline or Model only?

Following ML best practices, I use Scikit Pipelines to make sure my data preprocessing is the same at each model development iteration.

Also as a best practice, once I have completed model development I retrain the best model with the chosen hyperparameters on the entire dataset.

Now, in order to prepare for a deployment to production, I am trying to understand if I should export the model chosen itself, or the entire Pipeline object? I would want to apply the same exact preprocessing steps in production, correct?

You have to export the model which includes the list of transformers defined by the pipeline and the final estimator.

To give a simple example:

from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LinearRegression

import pickle