Can we apply feature scaling to "independent variable" in a dataset?

Viewed 1065

I have a dataset with 8 dependent variables (2 categorical data). I have applied ExtraTreeClassifier() to eliminate some of dependent variables. I had also feature scale the X,y .

 from sklearn.preprocessing import StandardScaler
 sc = StandardScaler()
 X = sc.fit_transform(X)
 X = sc.transform(X)
 y = sc.fit_transform(y)
 y = sc.transform(y)

And after this I have split the dataset like

from sklearn.cross_validation import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X_new, encoded2, 
test_size = 0.25, random_state = 0)

And now I am applying DecisionTreeRegressor algorithm for prediction. But I want to the actual prediction (right now I am getting scaled value). How to do that? Is there any other approach to do it? Because the way I have done is giving RMSE = 0.02 and if I am not feature scaling dependent variable RMSE = 18.4. Please suggest how to solve this kind of problem.

1 Answers

Well, first of all, scaling your target variables (y) isn't required but if you do scale it, StandardScaler and various other such preprocessing techniques have an inverse_transform function through which you can get your original values.

From the documentation of StandardScaler:

inverse_transform(X[, copy]) Scale back the data to the original representation

Related