Beispiel #1
0
model.add(layers.Dropout(0.5))

model.add(
    layers.Dense(128,
                 kernel_regularizer=regularizers.l1_l2(l1=0.0001, l2=0.0001),
                 activation='relu'))
model.add(layers.Dropout(0.5))

model.add(layers.Dense(1, activation='sigmoid'))
model.summary()

# COMPILATION
opt = keras.optimizers.Adadelta()
model.compile(optimizer=opt, loss='binary_crossentropy', metrics=['accuracy'])

# FIT
history = model.fit(x_train,
                    y_train,
                    epochs=100,
                    validation_split=0.25,
                    class_weight={
                        0: 1,
                        1: 2
                    },
                    batch_size=80,
                    shuffle=True)

# PLOT ACCURACY/VALIDATION CURVES
plot_model(model, to_file='t2_model.png', show_shapes=True)
training_plots.plot_metrics(history, 'T2')
model.add(layers.Dropout(0.5))

model.add(layers.Dense(256, activation='relu'))
model.add(layers.Dropout(0.5))

model.add(layers.Dense(128, kernel_regularizer = regularizers.l1_l2(l1=0.0001, l2=0.0001), activation='relu'))
model.add(layers.Dropout(0.5))

model.add(layers.Dense(1, activation='sigmoid'))
model.summary()

# COMPILATION
opt = tensorflow.keras.optimizers.Adadelta()
model.compile(optimizer=opt, loss='binary_crossentropy', metrics=['accuracy'])


# ask Keras to save best weights (in terms of validation loss) into file:
model_checkpoint = ModelCheckpoint(filepath='weights_ktrans_base.hdf5', monitor='val_loss', save_best_only=True)
# ask Keras to log each epoch loss:
csv_logger = CSVLogger('ktrans_log.csv', append=True, separator=';')
# ask Keras to log info in TensorBoard format:
tensorboard = TensorBoard(log_dir='ktrans_base/', write_graph=True, write_images=True)


# FIT
history = model.fit(x_train, y_train, epochs=100, validation_split=0.25, class_weight={0:1, 1:2}, batch_size=80, shuffle=True)

# PLOT ACCURACY/VALIDATION CURVES
plot_model(model, to_file='ktrans_model.png', show_shapes = True)
training_plots.plot_metrics(history, 'KTRANS')
Beispiel #3
0
model.add(layers.Dropout(0.5))

model.add(
    layers.Dense(128,
                 kernel_regularizer=regularizers.l1_l2(l1=0.0001, l2=0.0001),
                 activation='relu'))
model.add(layers.Dropout(0.5))

model.add(layers.Dense(1, activation='sigmoid'))
model.summary()

# COMPILATION
opt = keras.optimizers.Adadelta()
model.compile(optimizer=opt, loss='binary_crossentropy', metrics=['accuracy'])

# FIT
history = model.fit(x_train,
                    y_train,
                    epochs=100,
                    validation_split=0.25,
                    class_weight={
                        0: 1,
                        1: 2
                    },
                    batch_size=80,
                    shuffle=True)

# PLOT ACCURACY/VALIDATION CURVES
plot_model(model, to_file='bval_model.png', show_shapes=True)
training_plots.plot_metrics(history, 'BVAL')
Beispiel #4
0
model.add(layers.Dropout(0.5))

model.add(
    layers.Dense(128,
                 kernel_regularizer=regularizers.l1_l2(l1=0.0001, l2=0.0001),
                 activation='relu'))
model.add(layers.Dropout(0.5))

model.add(layers.Dense(1, activation='sigmoid'))
model.summary()

# COMPILATION
opt = keras.optimizers.Adadelta()
model.compile(optimizer=opt, loss='binary_crossentropy', metrics=['accuracy'])

# FIT
history = model.fit(x_train,
                    y_train,
                    epochs=100,
                    validation_split=0.25,
                    class_weight={
                        0: 1,
                        1: 2
                    },
                    batch_size=80,
                    shuffle=True)

# PLOT ACCURACY/VALIDATION CURVES
plot_model(model, to_file='adc_model.png', show_shapes=True)
training_plots.plot_metrics(history, 'ADC')