How to boost a Keras based neural network using AdaBoost?

后端 未结 3 706
-上瘾入骨i
-上瘾入骨i 2021-02-04 07:54

Assuming I fit the following neural network for a binary classification problem:

model = Sequential()
model.add(Dense(21, input_dim=19, init=\'uniform\', activat         


        
3条回答
  •  遥遥无期
    2021-02-04 08:50

    Keras itself does not implement adaboost. However, Keras models are compatible with scikit-learn, so you probably can use AdaBoostClassifier from there: link. Use your model as the base_estimator after you compile it, and fit the AdaBoostClassifier instance instead of model.

    This way, however, you will not be able to use the arguments you pass to fit, such as number of epochs or batch_size, so the defaults will be used. If the defaults are not good enough, you might need to build your own class that implements the scikit-learn interface on top of your model and passes proper arguments to fit.

提交回复
热议问题