Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Python application

on:
push:
branches: [ "main", "229-pico-scale-tests-on-hpo-setup" ]
branches: [ "main", "234-error-handling-on-finding-best-metric" ]

permissions:
contents: read
Expand Down Expand Up @@ -40,14 +40,12 @@ jobs:
# - name: Test text classifier - random search - ham-spam
# run: python3 text-class-ham-or-spam.py
# timeout-minutes: 90
# Add back !!!!
# - name: Test image classifier - small subset of CIFAR10 # add back
# timeout-minutes: 90
# run: python3 cifar10-example.py
#
- name: Generative Proof Of Concept
timeout-minutes: 180
run: python3 generative-proof-of-concept-CPU-preprocessing-in-memory.py
- name: Phishing email detection with GPT2 embedding
timeout-minutes: 420
run: python3 phishing_email_detection_gpt2.py
# - name: Phishing email detection with GPT2 embedding
# timeout-minutes: 420
# run: python3 phishing_email_detection_gpt2.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,18 +566,29 @@ def run_random_search(self):
print(f"metric_to_rank_by is: '{self.metric_to_rank_by}'")
print(
f"Type of metric_to_rank_by is: {str(type(self.metric_to_rank_by))}")
def has_valid_metric(num):
try:
float(num)
return True
except Exception as exc:
print(exc)
return False
rows_having_a_valid_metric = oracles[self.metric_to_rank_by].apply(lambda x: has_valid_metric(x))
oracles_having_valid_metrics = oracles[rows_having_a_valid_metric]

if self.direction == "maximize" or self.direction == "max":

best = float(oracles[oracles[self.metric_to_rank_by]
!= self.metric_to_rank_by]
[self.metric_to_rank_by].astype(float).max())
best = float(oracles_having_valid_metrics[self.metric_to_rank_by].astype(float).max())
# best = float(oracles[oracles[self.metric_to_rank_by]
# != self.metric_to_rank_by]
# [self.metric_to_rank_by].astype(float).max())
else:
print(f"metric_to_rank_by is: '{self.metric_to_rank_by}'")
print(
f"Type of metric_to_rank_by is: {str(type(self.metric_to_rank_by))}")
best = float(oracles[oracles[self.metric_to_rank_by]
!= self.metric_to_rank_by]
[self.metric_to_rank_by].astype(float).min())
best = float(oracles_having_valid_metrics[self.metric_to_rank_by].astype(float).min())
# best = float(oracles[oracles[self.metric_to_rank_by]
# != self.metric_to_rank_by]
# [self.metric_to_rank_by].astype(float).min())
print(f"Best result this trial was: {best}")
print(f"Type of best result: {type(best)}")
self.best_model_path =\
Expand Down
2 changes: 1 addition & 1 deletion generative-proof-of-concept-CPU-preprocessing-in-memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
N_TRIALS = 30


mlflow.set_tracking_uri(uri="http://127.0.0.1:{MLFLOW_PORT}")
mlflow.set_tracking_uri(uri=f"http://127.0.0.1:{MLFLOW_PORT}")

mlflow.set_experiment(f"single-worker-1st-pass-tuning-{EXPERIMENT_ITERATION}-a")

Expand Down
Loading