why OneHotEncoder give better results than get.dummies/reindex?

why OneHotEncoder give better results than get.dummies/reindex?










I can’t figure out why I get a better score with OneHotEncoder :

preprocessor = ColumnTransformer(

transformers=[

(‘cat’, categorical_transformer, categorical_cols)

],

remainder=’passthrough’ # <– this keeps the numerical columns

)

model_GBR = GradientBoostingRegressor(n_estimators=1100, loss=’squared_error’, subsample = 0.35, learning_rate = 0.05,random_state=1)

GBR_Pipeline = Pipeline(steps=[(‘preprocessor’, preprocessor),(‘model’, model_GBR)])

than get.dummies/reindex:

X_test = pd.get_dummies(d_test)

X_test_aligned = X_test.reindex(columns=X_train.columns, fill_value=0)

submitted by /u/Due-Duty961
[link] [comments]






/u/Due-Duty961





Go to original source





Posted

in

,

by

Tags: