Commit d5585cb0 authored by Ard Kastrati's avatar Ard Kastrati
Browse files

Merge branch 'master' of https://gitlab.ethz.ch/kard/dl-project

parents c6a9b41a e9ea07b7
......@@ -8,16 +8,15 @@ from keras.callbacks import CSVLogger
import logging
class prediction_history(tf.keras.callbacks.Callback):
def __init__(self, val_data):
self.val_data = val_data
def __init__(self,validation_data):
self.validation_data = validation_data
self.predhis = []
self.targets = []
self.targets = validation_data[1]
def on_batch_end(self, epoch, logs={}):
x_val, y_val = self.val_data
self.targets.append(y_val)
prediction = self.model.predict(x_val)
self.predhis.append(prediction)
def on_epoch_end(self, epoch, logs={}):
y_pred = self.model.predict(self.validation_data[0])
self.predhis.append(y_pred)
class ConvNet(ABC):
......@@ -113,19 +112,12 @@ class ConvNet(ABC):
return self.model
def fit(self, x, y):
print("Entered 1.")
csv_logger = CSVLogger(config['batches_log'], append=True, separator=';')
print("Entered 2.")
early_stop = tf.keras.callbacks.EarlyStopping(monitor='val_accuracy', patience=20)
print("Entered 3.")
ckpt_dir = config['model_dir'] + '/' + config['model'] + '_' + 'best_model.h5'
print("Entered 4.")
ckpt = tf.keras.callbacks.ModelCheckpoint(ckpt_dir, verbose=1, monitor='val_accuracy', save_best_only=True, mode='auto')
print("Entered 5.")
# X_train, X_val, y_train, y_val = train_test_split(x, y, test_size=0.2, random_state=42)
print("Entered 6.")
pred_ensemble = [] # prediction_history((X_val,y_val))
print("Entered 7.")
hist = self.model.fit(x, y, verbose=1, batch_size=self.batch_size, validation_split=0.2,
epochs=self.epochs, callbacks=[csv_logger, ckpt, early_stop,pred_ensemble])
return hist, pred_ensemble
\ No newline at end of file
X_train, X_val, y_train, y_val = train_test_split(x, y, test_size=0.2, random_state=42)
prediction_ensemble = prediction_history((X_val,y_val))
hist = self.model.fit(X_train, y_train, verbose=1, batch_size=self.batch_size, validation_data=(X_val,y_val),
epochs=self.epochs, callbacks=[csv_logger, ckpt, early_stop, prediction_ensemble])
return hist, prediction_ensemble
INFO:root:Started the Logging
INFO:root:X training loaded.
INFO:root:(129, 500, 36223)
INFO:root:y training loaded.
INFO:root:(1, 36223)
INFO:root:Setting the shapes
INFO:root:(36223, 500, 129)
INFO:root:(36223, 1)
INFO:tensorflow:Reloading Oracle from existing project kerasTunerResults/KerasTuner/oracle.json
INFO:root:Starting tuning xception
INFO:root:Parameters:
INFO:root:--------------- use residual : 1
INFO:root:--------------- depth : 6
INFO:root:--------------- batch size : 64
INFO:root:--------------- kernel size : 32
INFO:root:--------------- nb filters : 32
INFO:root:--------------- preprocessing: False
INFO:tensorflow:Reloading Tuner from kerasTunerResults/KerasTuner/tuner0.json
INFO:tensorflow:Oracle triggered exit
INFO:root:--- Runtime: 334.6214861869812 seconds ---
INFO:root:Finished Logging
{"ongoing_trials": {}, "hyperparameters": {"space": [{"class_name": "Choice", "config": {"name": "use_residual", "default": 1, "conditions": [], "values": [1, 0], "ordered": true}}, {"class_name": "Choice", "config": {"name": "kernel_size", "default": 40, "conditions": [], "values": [40, 32, 64], "ordered": true}}, {"class_name": "Choice", "config": {"name": "nb_filters", "default": 16, "conditions": [], "values": [16, 32, 64], "ordered": true}}, {"class_name": "Int", "config": {"name": "depth", "default": null, "conditions": [], "min_value": 6, "max_value": 20, "step": 3, "sampling": null}}], "values": {"use_residual": 1, "kernel_size": 40, "nb_filters": 16, "depth": 6}}, "seed": 6075, "seed_state": 6231, "tried_so_far": ["a5e1f0f6ae48858e36dce306481f5de6", "874145cfc904ccfb0a1c972f1e5875d2", "2c7b8c2a9a4eb7fa3cbeda58fbd29af4", "d0a162017ca5cbeeadce130e70a975ac", "d1b926f99c9de28674bff41add5fc218", "fe2e63b8c2a56182b8a1221771c38144", "bbdc977f0e8321de6a8c345415db232e", "010fb46acb67d9a2b5dbb006fc39c5ef", "f033faf2599568c544d13c890d5f873c", "17b3f7e413fa84df4e1fcb93e632f724", "ee7e7d54005cd7fcf641ca052628ae07", "b83d788c9e6e9083c5dcebb8e1c9e07c", "2d77ffcaa0a9ced4e2222f39024d4126", "4d32bca7d66b21c125d75253e02b25b3", "23314f21a7a1febe5a7300862e72b0eb", "dc62d500be25b1e7872ddca8c913356b", "b5e9792f62ce7bc97d0bda49e4321579", "494203ec473f13f95d8342293e3ba1c0", "4a0aa1b3c9f8f1e4202cd23e4f7bcaa9", "e4685bbdaa5259866c9f372105186fbb", "22d6fa839e2d6df77b17d7a0e412ede3", "f15614d1a727d5f56b43e4d519962025", "6a28888d5620b5db14cd35a1b41a547b", "bf5406778210281008f6eb7f22daca24", "eb6658551763073feed90667667918d1", "76936906a54c4badaf3997e203d9f02e", "bff87d1e1429b0f4441ab4ecf42997e4", "ff9880e63fa30a0c2a59a5b9eab6b3a7", "6659f5c08a04dab79eabfe7b379d2c4b", "531510a8e4346b829ef9e88e3d662575", "901e09674e37c2220c70b8ec98f46edf", "b9c94889a25de150dca6feb96c009f1d"]}
\ No newline at end of file
{"trial_id": "0133405ccc451e533ce260c403246af9", "hyperparameters": {"space": [{"class_name": "Choice", "config": {"name": "use_residual", "default": 1, "conditions": [], "values": [1, 0], "ordered": true}}, {"class_name": "Choice", "config": {"name": "kernel_size", "default": 40, "conditions": [], "values": [40, 32, 64], "ordered": true}}, {"class_name": "Choice", "config": {"name": "nb_filters", "default": 16, "conditions": [], "values": [16, 32, 64], "ordered": true}}, {"class_name": "Int", "config": {"name": "depth", "default": null, "conditions": [], "min_value": 6, "max_value": 20, "step": 3, "sampling": null}}], "values": {"use_residual": 1, "kernel_size": 40, "nb_filters": 16, "depth": 18}}, "metrics": {"metrics": {"loss": {"direction": "min", "observations": [{"value": [0.6909606456756592], "step": 0}]}, "accuracy": {"direction": "max", "observations": [{"value": [0.8940920829772949], "step": 0}]}, "val_loss": {"direction": "min", "observations": [{"value": [0.6919806599617004], "step": 0}]}, "val_accuracy": {"direction": "max", "observations": [{"value": [0.8643202185630798], "step": 0}]}}}, "score": 0.8643202185630798, "best_step": 0, "status": "COMPLETED"}
\ No newline at end of file
{"trial_id": "036c56f54ed296b9b24849ec74303b7c", "hyperparameters": {"space": [{"class_name": "Choice", "config": {"name": "use_residual", "default": 1, "conditions": [], "values": [1, 0], "ordered": true}}, {"class_name": "Choice", "config": {"name": "kernel_size", "default": 40, "conditions": [], "values": [40, 32, 64], "ordered": true}}, {"class_name": "Choice", "config": {"name": "nb_filters", "default": 16, "conditions": [], "values": [16, 32, 64], "ordered": true}}, {"class_name": "Int", "config": {"name": "depth", "default": null, "conditions": [], "min_value": 6, "max_value": 20, "step": 3, "sampling": null}}], "values": {"use_residual": 0, "kernel_size": 64, "nb_filters": 64, "depth": 15}}, "metrics": {"metrics": {"loss": {"direction": "min", "observations": [{"value": [0.6943278908729553], "step": 0}]}, "accuracy": {"direction": "max", "observations": [{"value": [0.8934363722801208], "step": 0}]}, "val_loss": {"direction": "min", "observations": [{"value": [0.8846703171730042], "step": 0}]}, "val_accuracy": {"direction": "max", "observations": [{"value": [0.830365777015686], "step": 0}]}}}, "score": 0.830365777015686, "best_step": 0, "status": "COMPLETED"}
\ No newline at end of file
{"trial_id": "04a3653c8549ffb5c91198c1e3c416b9", "hyperparameters": {"space": [{"class_name": "Choice", "config": {"name": "use_residual", "default": 1, "conditions": [], "values": [1, 0], "ordered": true}}, {"class_name": "Choice", "config": {"name": "kernel_size", "default": 40, "conditions": [], "values": [40, 32, 64], "ordered": true}}, {"class_name": "Choice", "config": {"name": "nb_filters", "default": 16, "conditions": [], "values": [16, 32, 64], "ordered": true}}, {"class_name": "Int", "config": {"name": "depth", "default": null, "conditions": [], "min_value": 6, "max_value": 20, "step": 3, "sampling": null}}], "values": {"use_residual": 0, "kernel_size": 64, "nb_filters": 16, "depth": 18}}, "metrics": {"metrics": {"loss": {"direction": "min", "observations": [{"value": [0.6954492330551147], "step": 0}]}, "accuracy": {"direction": "max", "observations": [{"value": [0.824487566947937], "step": 0}]}, "val_loss": {"direction": "min", "observations": [{"value": [0.6930277943611145], "step": 0}]}, "val_accuracy": {"direction": "max", "observations": [{"value": [0.8056590557098389], "step": 0}]}}}, "score": 0.8056590557098389, "best_step": 0, "status": "COMPLETED"}
\ No newline at end of file
{"trial_id": "0520202c75ed65f27ed963dae559a404", "hyperparameters": {"space": [{"class_name": "Choice", "config": {"name": "use_residual", "default": 1, "conditions": [], "values": [1, 0], "ordered": true}}, {"class_name": "Choice", "config": {"name": "kernel_size", "default": 40, "conditions": [], "values": [40, 32, 64], "ordered": true}}, {"class_name": "Choice", "config": {"name": "nb_filters", "default": 16, "conditions": [], "values": [16, 32, 64], "ordered": true}}, {"class_name": "Int", "config": {"name": "depth", "default": null, "conditions": [], "min_value": 6, "max_value": 20, "step": 3, "sampling": null}}], "values": {"use_residual": 0, "kernel_size": 40, "nb_filters": 32, "depth": 18}}, "metrics": {"metrics": {"loss": {"direction": "min", "observations": [{"value": [0.6936886310577393], "step": 0}]}, "accuracy": {"direction": "max", "observations": [{"value": [0.8234522938728333], "step": 0}]}, "val_loss": {"direction": "min", "observations": [{"value": [0.7024295330047607], "step": 0}]}, "val_accuracy": {"direction": "max", "observations": [{"value": [0.8060731291770935], "step": 0}]}}}, "score": 0.8060731291770935, "best_step": 0, "status": "COMPLETED"}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment