diff --git a/.gitignore b/.gitignore index 1a482e5..9b19ee6 100755 --- a/.gitignore +++ b/.gitignore @@ -10,9 +10,10 @@ experiment-power-draw/ stp sav bayes_* +times_* freq_* *.pkl bay frq sav -tmp \ No newline at end of file +tmp diff --git a/stopping_crit.py b/stopping_crit.py index 42ea41a..2358a04 100644 --- a/stopping_crit.py +++ b/stopping_crit.py @@ -1,22 +1,37 @@ -def earlyStopping(early_stopping: list, train_acc: float, sensitivity: float=1e-9): +import amd_sample_draw +from time import sleep + + +def earlyStopping(early_stopping: list, train_acc: float, epoch: int, sensitivity: float=1e-9): early_stopping.append(train_acc) if epoch % 4 == 0 and epoch > 0: - print("Value 1: {} >= {}, Value 2: {} >= {}, \ - Value 2: {} >= {}".format(early_stopping[0], \ - train_acc-sensitivity,early_stopping[1], \ - train_acc-sensitivity, early_stopping[2], train_acc-sensitivity)) - if abs(early_stopping[0]) >= train_acc-sensitivity and \ - abs(early_stopping[1]) >= train_acc-sensitivity and \ - abs(early_stopping[2]) >= train_acc-sensitivity: - return None - early_stopping = [] + print("Value 1: {} > Value 2: {} > \ + Value 3: {}".format(early_stopping[0], \ + abs(early_stopping[1]-sensitivity), \ + abs(early_stopping[2]-sensitivity))) + if train_acc > 0.5: + if early_stopping[0] > abs(early_stopping[1]-sensitivity) and \ + early_stopping[1] > abs(early_stopping[2]-sensitivity): + print("Stopping Early") + return 1 + del early_stopping[:] + return 0 def energyBound(threshold: float=100000.0): - if gpu_sample_draw.total_watt_consumed() > threshold: - return None - + try: + energy = amd_sample_draw.total_watt_consumed() + except Exception as e: + sleep(3) + energy = amd_sample_draw.total_watt_consumed() + print("Energy used: {}".format(energy)) + if energy > threshold: + print("Energy bound achieved") + return 1 + return 0 def accuracyBound(train_acc: float, threshold: float=0.99): if train_acc >= threshold: - return None \ No newline at end of file + print("Accuracy bound achieved") + return 1 + return 0 diff --git a/times_bayesian b/times_bayesian deleted file mode 100755 index bc0afae..0000000 --- a/times_bayesian +++ /dev/null @@ -1,19 +0,0 @@ -ini_1 = 12:03:15 -fin_1 = 12:13:26 -10m+11s - -ini_2 = 12:29:28 -fin_2 = 12:44:24 -15m+56s - -ini_3 = 13:00:55 -fin_3 = 13:21:06 -21m+11s - -ini_4 = 13:24:28 -fin_4 = 13:49:42 -25m+14s - -ini_5 = 14:14:27 -fin_5 = 14:44:57 -30m+30s diff --git a/times_freqentist b/times_freqentist deleted file mode 100755 index 6588e1f..0000000 --- a/times_freqentist +++ /dev/null @@ -1,19 +0,0 @@ -ini_1 = 11:08:51 -fin_1 = 11:12:04 -4m+13s - -ini_2 = 11:31:03 -fin_2 = 11:34:17 -3m+14s - -ini_3 = 11:25:17 -fin_3 = 11:28:31 -3m+14s - -ini_4 = 11:37:09 -fin_4 = 11:40:24 -3m+15s - -ini_5 = 11:43:29 -fin_5 = 11:46:48 -3m+19s