GBDT+LR级联实现

1. 背景

一般选择gbdt回归树

2. 实现

gbdt = GradientBoostingRegressor()
gbdt.fit(X_train, y_train)
model_fea = gbdt.apply(X_train)
model_fea_enc = enc.transform(model_fea).toarray()
X_train_new = np.concatenate([X_train, model_fea_enc], axis=1)

类别型特征处理

from keras.utils import np_utils
y_test = np_utils.to_categorical(y_test, num_classes=10)

from sklearn import preprocessing
X_test = preprocessing.scale(X_test)

11

你可能感兴趣的:(机器学习工程,python,人工智能)