-
Notifications
You must be signed in to change notification settings - Fork 56
Fix auto-select on model failure #998
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
Conversation
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.
looks good! Couple quick questions
except: | ||
from sklearn.metrics import r2_score | ||
|
||
from scipy.stats import linregress |
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.
Is scipy in the pyproject.toml?
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.
Not explicitly, statsmodels is there and it is dependent on scipy.
nonempty_metrics = {model: metric for model, metric in metrics.items() if metric != {}} | ||
avg_backtests_metric = {model: sum(value.values()) / len(value.values()) | ||
for model, value in nonempty_metrics.items()} | ||
best_model = min(avg_backtests_metric, key=avg_backtests_metric.get) |
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.
What if the metric is set to accuracy "r-squared"? Do we prevent this?
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.
The r-squared metric is not present in forecast/schema.yaml file as an allowed optimization metric, so it is not used for selecting the best model. Although it gets calculated when test data is provided only for reporting purpose.
ODSC-63260
Improved auto-select robustness by selecting the best among successful models.