sklearn - StandardScaler - Use in Production
I transformed my input data using StandardScaler as given here:
https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.StandardScaler.html
Code looks like this:
X=df_encoded.drop(columns=['HeartDisease'],axis=1)
y=df_encoded['HeartDisease']
col=X.columns
sc = StandardScaler()
x_standardized_array = sc.fit_transform(X)
x_df = pd.DataFrame(x_standardized_array, columns = col)
Now, my problem is that I need to deploy my final solution to a product service... actually providing the algorithm solution with a frontend. The StandardScaler is a problem because the product cannot be using the old data set to fit to the old data and then process the new data set. I can get access to the mean and scale arrays, however, there is no way that I see to initialize a StandardScaler with an existing mean and scale array.
How can I deploy a StandardScaler in production by initializing it with previous settings when the original data is not available or it is not practical to use the original data ?
Topic scikit-learn
Category Data Science