-
Notifications
You must be signed in to change notification settings - Fork 15
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
BAI-1141 Experiment Ordering #1376
Conversation
lib/python/src/bailo/helper/model.py
Outdated
if len(self.raw): | ||
for run in self.raw: | ||
if run["run"] == run_id: | ||
sel_run = run | ||
break | ||
else: | ||
raise NameError(f"Run {run_id} does not exist.") | ||
if (select_by is None) and (run_id is None): | ||
raise BailoException( | ||
"Either select_by (e.g. 'MIN|MAX:accuracy) or run_id is required to publish an experiment run." | ||
) | ||
if (select_by is not None) and (run_id is None): | ||
sel_run = self.__select_run(select_by=select_by) | ||
if run_id is not None: | ||
for run in self.raw: | ||
if run["run"] == run_id: | ||
sel_run = run | ||
break | ||
else: | ||
raise NameError(f"Run {run_id} does not exist.") | ||
else: | ||
raise BailoException(f"This experiment has no runs to publish.") |
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.
Could we make this flat rather than nested.
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.
Done
def publish( | ||
self, | ||
mc_loc: str, | ||
semver: str = "0.1.0", |
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.
Can we avoid giving a default. It's not used anywhere else in the application.
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.
This is needed
lib/python/src/bailo/helper/model.py
Outdated
runs = self.raw | ||
for run in runs: | ||
metrics = run["metrics"] | ||
for m in metrics: |
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.
Could we use for metric in metrics:
for clarity.
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.
Done
lib/python/tests/test_model.py
Outdated
@pytest.mark.integration | ||
def test_publish_experiment_standard_ordered(standard_experiment): | ||
standard_experiment.publish(mc_loc="performance.performanceMetrics", select_by="MAX:accuracy") | ||
|
||
model_card = standard_experiment.model.model_card | ||
model_card = NestedDict(model_card) | ||
metrics_array = model_card[("performance", "performanceMetrics")][0]["datasetMetrics"] | ||
|
||
expected_accuracy = 0.5 |
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.
Test for failure
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.
Done
lib/python/src/bailo/helper/model.py
Outdated
:param semver: Semantic version of release to create (if artifacts present), defaults to 0.1.0 or next | ||
:param notes: Notes for release, defaults to "" | ||
:param run_id: Local experiment run ID to be selected, defaults to None | ||
:param select_by: String describing experiment to be selected (e.g. "MIN|MAX:accuracy"), defaults to 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.
Format with this in accordance with MLFlow
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.
Done, now accuracy MIN|MAX
No description provided.