앞서 생성했던 모델에 배치 정규화를 배치해 보겠습니다.
코드 8-10 배치 정규화가 적용된 모델
from tensorflow.keras.initializers import RandomNormal, Constant
model2 = Sequential([
Dense(64, input_shape=(4,), activation="relu"),
BatchNormalization(),
Dense(128, activation='relu'),
BatchNormalization(),
Dense(128, activation='relu'),
BatchNormalization(),
Dense(64, activation='relu'),
BatchNormalization(),
Dense(64, activation='relu'),
BatchNormalization(
momentum=0.95,
epsilon=0.005,
beta_initializer=RandomNormal(mean=0.0, stddev=0.05),
gamma_initializer=Constant(value=0.9)
), ------ ①
Dense(3, activation='softmax')
]);
model2.summary()