Skip to content

FIX: move the BatchNormalization before the activation with no bias #531

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions doc/whats_new/v0.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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'))

Expand Down