-
Notifications
You must be signed in to change notification settings - Fork 2
Add streaming-in-data implementations #31
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
base: main
Are you sure you want to change the base?
Changes from all commits
b97f8e1
7df8255
a194f86
2b5558f
81be75d
e32eafe
ec7b010
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,6 +41,11 @@ Returns a [`SelectionResults`](results.md) object. | |||||||||||||
| members: false | ||||||||||||||
| show_bases: false | ||||||||||||||
|
|
||||||||||||||
| ::: agentopt.model_selection.streaming_random_search.StreamingRandomSearchModelSelector | ||||||||||||||
| options: | ||||||||||||||
| members: false | ||||||||||||||
| show_bases: false | ||||||||||||||
|
|
||||||||||||||
|
||||||||||||||
| ::: agentopt.model_selection.streaming_brute_force.StreamingBruteForceModelSelector | |
| options: | |
| members: false | |
| show_bases: false |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,13 +1,14 @@ | ||||||||||||||||||||||||||||||||
| # Selection Algorithms | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| AgentOpt provides 8 selection algorithms. Choose based on your search space size and evaluation budget. | ||||||||||||||||||||||||||||||||
| AgentOpt provides 9 selection algorithms. Choose based on your search space size and evaluation budget. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ## At a Glance | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| | Algorithm | Strategy | Evaluations | Best For | | ||||||||||||||||||||||||||||||||
| |:----------|:---------|:------------|:---------| | ||||||||||||||||||||||||||||||||
| | [Brute Force](#brute-force) | Exhaustive | All | Small spaces (< 50 combos) | | ||||||||||||||||||||||||||||||||
| | [Random Search](#random-search) | Sampling | Configurable fraction | Quick baselines | | ||||||||||||||||||||||||||||||||
| | [Streaming Random Search](#streaming-random-search) | Streaming sampling | Incremental | Online / incoming batches | | ||||||||||||||||||||||||||||||||
| | [Hill Climbing](#hill-climbing) | Greedy + restarts | Guided neighbors | Medium spaces | | ||||||||||||||||||||||||||||||||
|
Comment on lines
+3
to
12
|
||||||||||||||||||||||||||||||||
| | [Arm Elimination](#arm-elimination) | Progressive pruning | Adaptive | Statistical early stopping | | ||||||||||||||||||||||||||||||||
| | [Epsilon LUCB](#epsilon-lucb) | ε-optimal LUCB | Adaptive | Cost savings when ε-optimal is enough | | ||||||||||||||||||||||||||||||||
|
|
@@ -80,6 +81,38 @@ selector = RandomSearchModelSelector( | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| --- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ## Streaming Random Search | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| Samples a random subset once, then incrementally updates those sampled combinations as new batches arrive. | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ```python | ||||||||||||||||||||||||||||||||
| from agentopt import StreamingRandomSearchModelSelector | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| selector = StreamingRandomSearchModelSelector( | ||||||||||||||||||||||||||||||||
| agent=MyAgent, | ||||||||||||||||||||||||||||||||
| models=models, | ||||||||||||||||||||||||||||||||
| eval_fn=eval_fn, | ||||||||||||||||||||||||||||||||
| dataset=warm_start_dataset, # seed batch | ||||||||||||||||||||||||||||||||
| sample_fraction=0.25, | ||||||||||||||||||||||||||||||||
| seed=42, | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| selector.select_best() # evaluate warm start once | ||||||||||||||||||||||||||||||||
| selector.update(stream_batch_1) # keep updating online | ||||||||||||||||||||||||||||||||
|
Comment on lines
+95
to
+101
|
||||||||||||||||||||||||||||||||
| dataset=warm_start_dataset, # seed batch | |
| sample_fraction=0.25, | |
| seed=42, | |
| ) | |
| selector.select_best() # evaluate warm start once | |
| selector.update(stream_batch_1) # keep updating online | |
| sample_fraction=0.25, | |
| seed=42, | |
| ) | |
| # warm-start with an initial batch | |
| selector.update(warm_start_dataset) | |
| # then keep updating online as new batches arrive | |
| selector.update(stream_batch_1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StreamingBruteForceModelSelectoris used here with anagent_fnargument, but selectors in this repo (and the docs indocs/api/selectors.md) use anagentclass interface (__init__(models),run(input_data)). As implemented, the selector will also fail to initialize becauseBaseModelSelectordoesn’t acceptagent_fn. Consider updating the README example to the supportedagentinterface (or, if you intentionally add anagent_fnAPI, document it consistently and implement it in the base selector).