add optimizer
ci/woodpecker/push/woodpecker/2 Pipeline was successful Details
ci/woodpecker/push/woodpecker/1 Pipeline was successful Details
ci/woodpecker/push/woodpecker/4 Pipeline was successful Details
ci/woodpecker/push/woodpecker/3 Pipeline was successful Details

This commit is contained in:
Cornelius Specht 2024-06-13 11:37:49 +02:00
parent e24b6eef5a
commit 2443fcf2e3
2 changed files with 5 additions and 2 deletions

View File

@ -2,6 +2,9 @@ matrix:
EPOCHS: EPOCHS:
- 20 - 20
- 30 - 30
OPTIMIZER:
- adam
- SGD
steps: steps:
"train": "train":

4
run.py
View File

@ -9,7 +9,7 @@ from keras import backend as K
K.clear_session() K.clear_session()
EPOCHS = int(os.getenv("EPOCHS", default = 10)) EPOCHS = int(os.getenv("EPOCHS", default = 10))
OPTIMIZER = os.getenv("OPTIMIZER", default = "SGD")
gpus = tf.config.experimental.list_physical_devices('GPU') gpus = tf.config.experimental.list_physical_devices('GPU')
@ -72,7 +72,7 @@ with tf.device('/GPU:0'):
keras.layers.Dense(10, activation='sigmoid') keras.layers.Dense(10, activation='sigmoid')
]) ])
# g # g
model.compile(optimizer='SGD', model.compile(optimizer=OPTIMIZER,
loss='categorical_crossentropy', loss='categorical_crossentropy',
metrics=['accuracy']) metrics=['accuracy'])
model.fit(X_train_scaled, y_train_categorical, epochs=EPOCHS) model.fit(X_train_scaled, y_train_categorical, epochs=EPOCHS)