Skip to content

Commit 7ac4c25

Browse files
committed
Rename on-task/off-task to target/source in streamlit
1 parent e939b4d commit 7ac4c25

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

streamlit/surrogate_models.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ def main():
113113
)
114114
if st_enable_multitask:
115115
st_n_training_points_other = st.sidebar.slider(
116-
"Number of off-task training points", 0, 20, 5
116+
"Number of source training points", 0, 20, 5
117117
)
118-
st_offtask_scale = st.sidebar.slider("Off-task scale factor", -20.0, 20.0, 1.0)
118+
st_offtask_scale = st.sidebar.slider("Source scale factor", -20.0, 20.0, 1.0)
119119
st_offtask_offset_factor = st.sidebar.slider(
120-
"Off-task offset", -100.0, 100.0, 0.0
120+
"Source offset", -100.0, 100.0, 0.0
121121
)
122122

123123
# Model
@@ -182,15 +182,15 @@ def main():
182182
)
183183

184184
# Generate task-specific transforms (scale and offset for each task)
185-
task_names = ["on-task", "off-task"] if st_n_tasks > 1 else ["on-task"]
185+
task_names = ["target", "source"] if st_n_tasks > 1 else ["target"]
186186
task_transforms = {}
187187
for task_idx in range(st_n_tasks):
188188
task_name = task_names[task_idx]
189189
if task_idx == 0:
190-
# On-task: use original function values
190+
# Target: use original function values
191191
task_transforms[task_name] = {"scale": 1.0, "offset": 0.0}
192192
else:
193-
# Off-task: use user-specified scale and offset
193+
# Source: use user-specified scale and offset
194194
scale = st_offtask_scale
195195
offset = st_offtask_offset_factor * st_function_amplitude
196196
task_transforms[task_name] = {"scale": scale, "offset": offset}
@@ -244,7 +244,7 @@ def main():
244244
TaskParameter(
245245
name="task",
246246
values=task_names,
247-
active_values=["on-task"],
247+
active_values=["target"],
248248
)
249249
)
250250
searchspace = SearchSpace.from_product(parameters=parameters)
@@ -276,7 +276,7 @@ def make_surrogate():
276276
surrogate_model=make_surrogate(),
277277
acquisition_function=acqf,
278278
)
279-
if task_name == "on-task":
279+
if task_name == "target":
280280
try:
281281
recommendations = task_recommender.recommend(
282282
st_n_recommendations, searchspace, objective, task_meas
@@ -345,7 +345,7 @@ def make_surrogate():
345345
plt.plot(task_train_x, train_y, "o", color="tab:blue")
346346
plt.plot(test_x, mean, color="tab:red", label="Surrogate model")
347347
plt.fill_between(test_x, mean - std, mean + std, alpha=0.2, color="tab:red")
348-
if task_name == "on-task":
348+
if task_name == "target":
349349
plt.vlines(
350350
recommendations["x"] if st_n_tasks > 1 else recommendations,
351351
*plt.gca().get_ylim(),

0 commit comments

Comments
 (0)