Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add bo template #322

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
show coder result in webapp (not show evolving code)
  • Loading branch information
XianBW committed Oct 22, 2024
commit 0595a498c3a83c3636d1ae74352c81f6d67fd464
17 changes: 9 additions & 8 deletions rdagent/app/kaggle/bo_loop.py
Original file line number Diff line number Diff line change
@@ -85,13 +85,14 @@ def propose(self, prev_out: dict[str, Any]):
return hypothesis_list

def _develop(self, hypothesis):
exp = self.hypothesis2experiment.convert(hypothesis, self.trace)
if hypothesis.action in [KG_ACTION_FEATURE_ENGINEERING, KG_ACTION_FEATURE_PROCESSING]:
code = self.feature_coder.develop(exp)
elif hypothesis.action == KG_ACTION_MODEL_FEATURE_SELECTION:
code = self.model_feature_selection_coder.develop(exp)
else:
code = self.model_coder.develop(exp)
with logger.tag("d"): # develop
exp = self.hypothesis2experiment.convert(hypothesis, self.trace)
if hypothesis.action in [KG_ACTION_FEATURE_ENGINEERING, KG_ACTION_FEATURE_PROCESSING]:
code = self.feature_coder.develop(exp)
elif hypothesis.action == KG_ACTION_MODEL_FEATURE_SELECTION:
code = self.model_feature_selection_coder.develop(exp)
else:
code = self.model_coder.develop(exp)
return code

def _estimate(self, code):
@@ -128,8 +129,8 @@ def select(self, prev_out):
hs.append(hypotheses[i])
m = max(results)
index = results.index(m)
logger.log_object(codes[index].sub_workspace_list, tag="d.coder result")
logger.log_object(hs[index], tag="r.hypothesis generation")
logger.log_object(codes[index].sub_workspace_list, tag="d.coder result")

return codes[index], hs[index]

16 changes: 16 additions & 0 deletions rdagent/log/ui/app.py
Original file line number Diff line number Diff line change
@@ -551,6 +551,22 @@ def feedback_window():
def evolving_window():
title = "Development🛠️" if isinstance(state.scenario, SIMILAR_SCENARIOS) else "Development🛠️ (evolving coder)"
st.subheader(title, divider="green", anchor="_development")

# TODO: only for suhan, add a check before merging to main
if len(state.msgs[round]["d.coder result"]) != 1:
st.toast(":red[**Coder result Length Error!**]", icon="!")
ws: list[FactorFBWorkspace | ModelFBWorkspace] = state.msgs[round]["d.coder result"][-1].content
tab_names = [
w.target_task.factor_name if isinstance(w.target_task, FactorTask) else w.target_task.name for w in ws
]
wtabs = st.tabs(tab_names)
for j, w in enumerate(ws):
with wtabs[j]:
# Evolving Code
for k, v in w.code_dict.items():
with st.expander(f":green[`{k}`]", expanded=True):
st.code(v, language="python")
return

# Evolving Status
if state.erounds[round] > 0:
Loading
Oops, something went wrong.