How to use the same scale with new data? - scikit learn - scikit learn
IMO, you don't need to use scaling if your classifiers are based on decision trees. Also, in your final piece of code, the variable scaler is never used, so I am not sure at all why it is defined. Nevertheless, if you insist on using a scaler, you should Pipeline it so it automatically applies to the test data the same scaling it has learned by fitting to training data:

pipeline = Pipeline([('scaler', StandardScaler()), ('classifier', DecisionTreeClassifier())])
pipeline.fit(X_train, y_train)
predictions = pipeline.predict(X_test)


Note that you'd obviously need to import the necessary modules (I was too lazy to write them here!).