I believe the issue is that fit_transform does not really store the mean and standard deviation. You need to first fit the transform using: scaler = preprocessing.StandardScaler(); scaler.fit(X) df_scaled = scaler.transform(X) # In your prediction step clf.predict(scaler.transform(query_df)...
Create scikit-learn'sPipelineobject and populate it with any pre-processing steps and the model object. fromsklearn.pipelineimportPipelinefromsklearn.treeimportDecisionTreeClassifierfromsklearn.preprocessingimportStandardScalerpipeline_obj=Pipeline([ ("scaler",StandardScaler()), ("model",DecisionTreeClassifier...
import numpy as np import matplotlib.pyplot as plt import pandas as pd Importing the dataset dataset = pd.read_csv('Position_Salaries.csv') X = dataset.iloc[:, 1:2].values y = dataset.iloc[:, 2].values Feature Scaling from sklearn.preprocessing import StandardScaler sc_X = StandardScaler...