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
Next Next commit
Add bo template
  • Loading branch information
you-n-g committed Sep 23, 2024
commit 86e7d6b017781d66ff03b73c02166c493324dfec
74 changes: 74 additions & 0 deletions rdagent/app/kaggle/bo_loop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
"""
Differences from kaggle loop
- focused on a specific component(we must simplify it to align the grainularity of the idea and experiment).
- replace the idea proposal to another component.
- (trick) we don't want to develop again. we want to reused the code in the BO-process
- cached Developer(input is same idea, return the cached solution)
- the cache can be disabled.
- evaluation results.


- Align the nouns:
- e: Workspace
- h: tasks or hypothesis?
"""


from rdagent.core.developer import Developer
from rdagent.core.experiment import Workspace
from rdagent.core.proposal import HypothesisGen


class BODev(Developer):
"""
Differences:
- save <h, e, s> results.
- self evaluate a solution based <e, s>
- directly query previous <h, e> based on e.
"""
def __init__(self):
self.hypo2exp #
self.dev # normal dev
... # knowledge storage

def evaluate(self, ws: Workspace):
...

def udpate_feedback(self, e,s):
...


class BOHypothesisGen(HypothesisGen):

def __init__(self, scen: Scenario, bodev: BODev) -> None:
self.bodev = bodev
super().__init__(scen)

def gen(self, ...):
# 1) exploration : propose idea
ideas = ...
# 2) evaluate ideas with self.bodev
# ..... scors distribution
# 3) sample idea based on ideas & scores(as weight)
return selected_idea


# - interface:
# - implemenation: use RepoAnalyzer + key code => score


class BOLoop:
@measure_time
def __init__(self, PROP_SETTING: BasePropSetting):
with logger.tag("init"):
...
self.bodev = BODev
self.bohypogen = BOHypothesisGen(..., self.bodev)
...

...
def running(self): # feedback
# collect <h, e, s>
# or feeback
e, s = self.trace ...
self.bodev.update_feedack(e, s) #
Loading
Oops, something went wrong.