Skip to content

Commit

Permalink
FIX: move the BatchNormalization before the activation with no bias (s…
Browse files Browse the repository at this point in the history
glemaitre authored Jan 19, 2019
1 parent b62143d commit f79cc92
Showing 2 changed files with 16 additions and 7 deletions.
9 changes: 9 additions & 0 deletions doc/whats_new/v0.5.rst
Original file line number Diff line number Diff line change
@@ -22,3 +22,12 @@ Maintenance

- Make it possible to ``import imblearn`` and access submodule.
:issue:`500` by :user:`Guillaume Lemaitre <glemaitre>`.

Bug
...

- Fix wrong usage of :class:`keras.layers.BatchNormalization` in
``porto_seguro_keras_under_sampling.py`` example. The batch normalization
was moved before the activation function and the bias was removed from the
dense layer.
:issue:`531` by :user:`Guillaume Lemaitre <glemaitre>`.
14 changes: 7 additions & 7 deletions examples/applications/porto_seguro_keras_under_sampling.py
Original file line number Diff line number Diff line change
@@ -98,20 +98,20 @@ def make_model(n_features):
model = Sequential()
model.add(Dense(200, input_shape=(n_features,),
kernel_initializer='glorot_normal'))
model.add(Activation('relu'))
model.add(BatchNormalization())
model.add(Dropout(0.5))
model.add(Dense(100, kernel_initializer='glorot_normal'))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(100, kernel_initializer='glorot_normal', use_bias=False))
model.add(BatchNormalization())
model.add(Dropout(0.25))
model.add(Dense(50, kernel_initializer='glorot_normal'))
model.add(Activation('relu'))
model.add(Dropout(0.25))
model.add(Dense(50, kernel_initializer='glorot_normal', use_bias=False))
model.add(BatchNormalization())
model.add(Dropout(0.15))
model.add(Dense(25, kernel_initializer='glorot_normal'))
model.add(Activation('relu'))
model.add(Dropout(0.15))
model.add(Dense(25, kernel_initializer='glorot_normal', use_bias=False))
model.add(BatchNormalization())
model.add(Activation('relu'))
model.add(Dropout(0.1))
model.add(Dense(1, activation='sigmoid'))

0 comments on commit f79cc92

Please sign in to comment.