Skip to content

Commit 70ccfab

Browse files
committed
Reorganize project structure: clean up containers and prefect scripts
- Remove docker-learning folder (will rebuild from scratch) - Clean up bo-containerized folder, keep only requirements.txt and core files - Remove automated Branin functions from HITL workflow for true human-in-the-loop - Reorganize prefect_scripts folder, move old scripts to sample_scripts - Prepare structure for MongoDB integration and containerization
1 parent 072d8a0 commit 70ccfab

38 files changed

Lines changed: 444 additions & 694 deletions

bo-containerized/Dockerfile

Lines changed: 0 additions & 30 deletions
This file was deleted.

bo-containerized/README.md

Lines changed: 0 additions & 87 deletions
This file was deleted.

bo-containerized/complete_workflow/bo_hitl_slack_tutorial.py renamed to bo-containerized/bo_hitl_slack_tutorial.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,6 @@
4040
subprocess.check_call([sys.executable, "-m", "pip", "install", "ax-platform"])
4141
from ax.service.ax_client import AxClient, ObjectiveProperties
4242

43-
# Define our own Branin function since ax.utils.measurement.synthetic_functions might not be available
44-
def branin(x1, x2):
45-
"""Branin synthetic benchmark function"""
46-
a = 1
47-
b = 5.1 / (4 * np.pi**2)
48-
c = 5 / np.pi
49-
r = 6
50-
s = 10
51-
t = 1 / (8 * np.pi)
52-
53-
return a * (x2 - b * x1**2 + c * x1 - r)**2 + s * (1 - t) * np.cos(x1) + s
54-
5543
# Import Prefect and Slack for HITL workflow
5644
import asyncio
5745
from prefect import flow, get_run_logger, settings, task
@@ -61,7 +49,8 @@ def branin(x1, x2):
6149
from prefect.flow_runs import pause_flow_run
6250

6351
class ExperimentInput(RunInput):
64-
"""Input model for experiment evaluation"""
52+
""" Defines the data structure for human input
53+
humans must provide objective_value (float) + optional notes"""
6554
objective_value: float
6655
notes: str = ""
6756

@@ -105,12 +94,9 @@ def complete_experiment(ax_client: AxClient, trial_index: int, objective_value:
10594
ax_client.complete_trial(trial_index=trial_index, raw_data=objective_value)
10695

10796

108-
def evaluate_branin(parameters: Dict) -> float:
109-
"""Evaluate the Branin function for the given parameters (automated evaluation)"""
110-
return float(branin(x1=parameters["x1"], x2=parameters["x2"]))
111-
11297
def generate_api_instructions(parameters: Dict) -> str:
113-
"""Generate instructions for using the HuggingFace API to evaluate Branin function"""
98+
"""Generate instructions that is part of the Slack Message for
99+
using the HuggingFace API to evaluate Branin function"""
114100
x1_value = parameters['x1']
115101
x2_value = parameters['x2']
116102

@@ -148,7 +134,7 @@ def generate_api_instructions(parameters: Dict) -> str:
148134
@flow(name="bo-hitl-slack-campaign")
149135
def run_bo_campaign(n_iterations: int = 5, random_seed: int = 42):
150136
"""
151-
Main Bayesian Optimization campaign with human-in-the-loop evaluation via Slack
137+
Bayesian Optimization campaign with human-in-the-loop evaluation via Slack
152138
153139
This implements a human-in-the-loop workflow:
154140
1. User runs Python script starting BO campaign with Ax

bo-containerized/complete_workflow/create_bo_hitl_deployment.py

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)