Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b4a5576
added additional task agnostic local result to print of run
LennartPurucker Feb 22, 2023
ece79f0
add PR to progress.rst
LennartPurucker Feb 22, 2023
a09c850
fix comment typo
LennartPurucker Feb 22, 2023
c8724b6
Update openml/runs/run.py
LennartPurucker Feb 22, 2023
b6af420
add a function to list available estimation procedures
LennartPurucker Feb 23, 2023
5258ded
refactor print to only work for supported task types and local measures
LennartPurucker Feb 23, 2023
f15a1d8
add test for pint out and update progress
LennartPurucker Feb 23, 2023
167dfd2
Merge branch 'develop' into run_print
LennartPurucker Feb 23, 2023
ca1c5a8
added additional task agnostic local result to print of run
LennartPurucker Feb 22, 2023
8a572fe
add PR to progress.rst
LennartPurucker Feb 22, 2023
27c2c15
fix comment typo
LennartPurucker Feb 22, 2023
454364e
Update openml/runs/run.py
LennartPurucker Feb 22, 2023
bbb849d
add a function to list available estimation procedures
LennartPurucker Feb 23, 2023
47f4346
refactor print to only work for supported task types and local measures
LennartPurucker Feb 23, 2023
992dc52
add test for pint out and update progress
LennartPurucker Feb 23, 2023
2785ad8
Merge branch 'run_print' of https://github.com/LennartPurucker/openml…
LennartPurucker Feb 24, 2023
a20536a
Merge branch 'develop' of https://github.com/openml/openml-python int…
LennartPurucker Feb 24, 2023
5730669
Fix CI Python 3.6 (#1218)
mfeurer Feb 24, 2023
5b2ac46
Bump docker/setup-buildx-action from 1 to 2 (#1221)
dependabot[bot] Feb 24, 2023
5dcb7a3
Update run.py (#1194)
v-parmar Feb 24, 2023
fb58411
add type hint for new function
LennartPurucker Feb 24, 2023
6dbb498
update add description
LennartPurucker Feb 24, 2023
687a0f1
Refactor if-statements (#1219)
PGijsbers Mar 1, 2023
c0a75bd
Ci python 38 (#1220)
mfeurer Mar 1, 2023
502988b
added additional task agnostic local result to print of run
LennartPurucker Feb 22, 2023
1bb2b1f
add PR to progress.rst
LennartPurucker Feb 22, 2023
741f766
fix comment typo
LennartPurucker Feb 22, 2023
c5b0789
Update openml/runs/run.py
LennartPurucker Feb 22, 2023
9706132
add a function to list available estimation procedures
LennartPurucker Feb 23, 2023
4493b12
refactor print to only work for supported task types and local measures
LennartPurucker Feb 23, 2023
f3d5753
add test for pint out and update progress
LennartPurucker Feb 23, 2023
cd91ba0
added additional task agnostic local result to print of run
LennartPurucker Feb 22, 2023
dea48f4
add PR to progress.rst
LennartPurucker Feb 22, 2023
8b86816
add type hint for new function
LennartPurucker Feb 24, 2023
b3b4447
update add description
LennartPurucker Feb 24, 2023
4ba2dc0
fix run doc string
LennartPurucker Mar 1, 2023
4907755
Merge remote-tracking branch 'origin/run_print' into run_print
LennartPurucker Mar 1, 2023
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
added additional task agnostic local result to print of run
  • Loading branch information
LennartPurucker committed Feb 22, 2023
commit b4a5576d9bf577a068323b353698d41fbc0e4c55
63 changes: 56 additions & 7 deletions openml/runs/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,37 @@ def predictions(self) -> pd.DataFrame:
def id(self) -> Optional[int]:
return self.run_id

def evaluation_summary(self, metric: str):
Comment thread
LennartPurucker marked this conversation as resolved.
Outdated
"""Summarizes the evaluation of a metric over all folds.

The fold scores for the metric must exist already. During run creation,
by default, the MAE for OpenMLRegressionTask and the accuracy for
OpenMLClassificationTask/OpenMLLearningCurveTasktasks are computed.

If repetition exist, we take the mean over all repetitions.

Parameters
----------
metric: str
Name of an evaluation metric that was used to compute fold scores.

Returns
-------
metric_summary: str
A formatted string that displays the metric's evaluation summary.
The summary consists of the mean and std.
"""
fold_score_lists = self.fold_evaluations[metric].values()

# Get the mean and std over all repetitions
rep_means = [np.mean(list(x.values())) for x in fold_score_lists]
rep_stds = [np.std(list(x.values())) for x in fold_score_lists]

return "{:.4f} +- {:.4f}".format(np.mean(rep_means), np.mean(rep_stds))
Comment thread
LennartPurucker marked this conversation as resolved.

def _get_repr_body_fields(self) -> List[Tuple[str, Union[str, int, List[str]]]]:
"""Collect all information to display in the __repr__ body."""
# Set up fields
fields = {
"Uploader Name": self.uploader_name,
"Metric": self.task_evaluation_measure,
Expand All @@ -156,6 +185,10 @@ def _get_repr_body_fields(self) -> List[Tuple[str, Union[str, int, List[str]]]]:
"Dataset ID": self.dataset_id,
"Dataset URL": openml.datasets.OpenMLDataset.url_for_id(self.dataset_id),
}

# determines the order of the initial fields in which the information will be printed
order = ["Uploader Name", "Uploader Profile", "Metric", "Result"]

if self.uploader is not None:
fields["Uploader Profile"] = "{}/u/{}".format(
openml.config.get_server_base_url(), self.uploader
Expand All @@ -164,13 +197,29 @@ def _get_repr_body_fields(self) -> List[Tuple[str, Union[str, int, List[str]]]]:
fields["Run URL"] = self.openml_url
if self.evaluations is not None and self.task_evaluation_measure in self.evaluations:
fields["Result"] = self.evaluations[self.task_evaluation_measure]

# determines the order in which the information will be printed
order = [
"Uploader Name",
"Uploader Profile",
"Metric",
"Result",
elif self.fold_evaluations is not None:
# -- Add Locally computed summary values to if possible
if "predictive_accuracy" in self.fold_evaluations:
# OpenMLClassificationTask; OpenMLLearningCurveTask
# default: predictive_accuracy
result_field = "Local Result - Accuracy (+- STD)"
fields[result_field] = self.evaluation_summary("predictive_accuracy")
order.append(result_field)
elif "mean_absolute_error" in self.fold_evaluations:
# OpenMLRegressionTask
# default: mean_absolute_error
result_field = "Local Result - MAE (+- STD)"
fields[result_field] = self.evaluation_summary("mean_absolute_error")
order.append(result_field)

rt_field = "Local Runtime - ms (+- STD)"
fields[rt_field] = self.evaluation_summary("usercpu_time_millis")

# Add to order to be below / same as results
order.append(rt_field)

# determines the remaining order
order += [
"Run ID",
"Run URL",
"Task ID",
Expand Down