-
Notifications
You must be signed in to change notification settings - Fork 0
feat: gate optimization by dof multiplier #116
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -514,6 +514,26 @@ def run_all(self, only_cached: bool = False) -> list[BestResult]: | |
| else: | ||
| search_space[name] = options | ||
|
|
||
| n_params = len(search_space) | ||
| dof_multiplier = self.cfg.param_dof_multiplier | ||
| min_bars_floor = self.cfg.param_min_bars | ||
| min_bars_for_optimization = max(min_bars_floor, dof_multiplier * n_params) | ||
| if search_space and len(df) < min_bars_for_optimization: | ||
| self.logger.info( | ||
| "skipping optimization due to insufficient bars", | ||
| collection=col.name, | ||
| symbol=symbol, | ||
| timeframe=timeframe, | ||
| bars=len(df), | ||
| min_bars=min_bars_for_optimization, | ||
| n_params=n_params, | ||
| dof_multiplier=dof_multiplier, | ||
| min_bars_floor=min_bars_floor, | ||
| strategy=strat.name, | ||
| search_method=search_method, | ||
| ) | ||
| search_space = {} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When data is below the new threshold, Useful? React with 👍 / 👎. |
||
|
|
||
| best_val = -np.inf | ||
| best_params: dict[str, Any] | None = None | ||
| best_stats: dict[str, Any] | None = None | ||
|
|
||
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.
Search space parameters silently dropped when gate triggers
High Severity
When the data-sufficiency gate triggers and clears
search_space = {}, parameters that had multiple options are silently lost. They are never transferred intofixed_params, so the subsequentevaluate({})call constructsfull_paramswithout them. The strategy then runs with missing parameters, likely producing incorrect results or failures. The search-space parameters need default values (e.g., first option from each list) added tofixed_paramsbefore clearingsearch_space.