Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
f16ba08
minor fixes to usage.rst (#1090)
mfeurer May 31, 2021
6717e66
Add Windows to Github Action CI matrix (#1095)
PGijsbers Jun 16, 2021
2984403
Add ChunkedError to list of retry exception (#1118)
PGijsbers Oct 27, 2021
a6c0576
Always ignore MaxRetryError but log with warning (#1119)
PGijsbers Oct 27, 2021
b4c868a
Fix/1110 (#1117)
PGijsbers Oct 28, 2021
aed5010
Add AttributeError as suspect for dependency issue (#1121)
PGijsbers Nov 3, 2021
db7bb9a
Add CITATION.cff (#1120)
PGijsbers Jan 11, 2022
493511a
Precommit update (#1129)
PGijsbers Apr 14, 2022
99a62f6
Predictions (#1128)
PGijsbers Apr 19, 2022
c911d6d
Use GET instead of POST for flow exist (#1147)
PGijsbers Jun 28, 2022
c6fab8e
pre-commit update (#1150)
PGijsbers Jul 11, 2022
a8d96d5
Replace removed file with new target for download test (#1158)
PGijsbers Aug 16, 2022
ccb3e8e
Fix outdated docstring for list_tasks function (#1149)
chadmarchand Oct 6, 2022
9ce2a6b
Improve the error message on out-of-sync flow ids (#1171)
PGijsbers Oct 7, 2022
2ed77db
Add scikit-learn 1.0 and 1.1 values for test (#1168)
PGijsbers Oct 7, 2022
2fde8d5
Update Pipeline description for >=1.0 (#1170)
PGijsbers Oct 7, 2022
2ddae0f
Update URL to reflect new endpoint (#1172)
PGijsbers Oct 7, 2022
c17704e
Remove tests which only test scikit-learn functionality (#1169)
PGijsbers Oct 7, 2022
953f84e
fix nonetype error during print for tasks without class labels (#1148)
willcmartin Oct 7, 2022
6da0aac
Flow exists GET is deprecated, use POST (#1173)
PGijsbers Oct 10, 2022
22ee9cd
Test `get_parquet` on production server (#1174)
PGijsbers Oct 11, 2022
5cd6973
Refactor out different test cases to separate tests (#1176)
PGijsbers Oct 18, 2022
e6250fa
Provide clearer error when server provides bad data description XML (…
PGijsbers Oct 24, 2022
75fed8a
Update more sklearn tests (#1175)
PGijsbers Oct 24, 2022
f37ebbe
Remove dtype checking for prediction comparison (#1177)
PGijsbers Nov 24, 2022
a909a0c
feat(minio): Allow for proxies (#1184)
eddiebergman Nov 25, 2022
1dfe398
Update __version__.py (#1189)
PGijsbers Nov 25, 2022
580b536
Download all files (#1188)
PGijsbers Nov 25, 2022
5eb84ce
Skip tests that use arff reading optimization for typecheck (#1185)
PGijsbers Nov 25, 2022
467f6eb
Update configs (#1199)
PGijsbers Feb 20, 2023
dd62f2b
Update tests for sklearn 1.2, server issue (#1200)
PGijsbers Feb 20, 2023
2a7ab17
Version bump to dev and add changelog stub (#1190)
PGijsbers Feb 20, 2023
5f72e2e
Add: dependabot checks for workflow versions (#1155)
eddiebergman Feb 20, 2023
7d069a9
Change the cached file to reflect new standard #1188 (#1203)
PGijsbers Feb 21, 2023
23755bf
Bump actions/checkout from 2 to 3 (#1206)
dependabot[bot] Feb 21, 2023
603fe60
Update docker actions (#1211)
mfeurer Feb 22, 2023
17ff086
Support new numpy (#1215)
mfeurer Feb 23, 2023
d9850be
Allow unknown task types on the server (#1216)
mfeurer Feb 23, 2023
a968288
Mark sklearn tests (#1202)
PGijsbers Feb 23, 2023
beb598c
Bump actions/setup-python from 2 to 4 (#1212)
dependabot[bot] Feb 24, 2023
c590b3a
Make OpenMLTraceIteration a dataclass (#1201)
PGijsbers Feb 24, 2023
bbf09b3
Fix: correctly order the ground truth and prediction for ARFF files i…
LennartPurucker Feb 24, 2023
b84536a
Fix documentation building (#1217)
mfeurer 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
687a0f1
Refactor if-statements (#1219)
PGijsbers Mar 1, 2023
c0a75bd
Ci python 38 (#1220)
mfeurer Mar 1, 2023
ce82fd5
Add summary of locally computed metrics to representation of run (#…
LennartPurucker Mar 1, 2023
c177d39
Better Error for Checksum Mismatch (#1225)
LennartPurucker Mar 4, 2023
24cbc5e
Fix coverage (#1226)
PGijsbers Mar 4, 2023
3c00d7b
Issue 1028: public delete functions for run, task, flow and database …
Mirkazemi Mar 21, 2023
7127e9c
Update changelog and version number for new release (#1230)
mfeurer Mar 22, 2023
bb3793d
Merge pull request #1233 from openml/main
mfeurer Mar 22, 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
Prev Previous commit
Next Next commit
Add summary of locally computed metrics to representation of run (#1214)
* added additional task agnostic local result to print of run

* add PR to progress.rst

* fix comment typo

* Update openml/runs/run.py

Co-authored-by: Matthias Feurer <lists@matthiasfeurer.de>

* add a function to list available estimation procedures

* refactor print to only work for supported task types and local measures

* add test for pint out and update progress

* added additional task agnostic local result to print of run

* add PR to progress.rst

* fix comment typo

* Update openml/runs/run.py

Co-authored-by: Matthias Feurer <lists@matthiasfeurer.de>

* add a function to list available estimation procedures

* refactor print to only work for supported task types and local measures

* add test for pint out and update progress

* Fix CI Python 3.6 (#1218)

* Try Ubunte 20.04 for Python 3.6

* use old ubuntu for python 3.6

* Bump docker/setup-buildx-action from 1 to 2 (#1221)

Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 1 to 2.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](docker/setup-buildx-action@v1...v2)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update run.py (#1194)

* Update run.py

* Update run.py

updated description to not contain duplicate information.

* Update run.py

* add type hint for new function

* update add description

* Refactor if-statements (#1219)

* Refactor if-statements

* Add explicit names to conditional expression

* Add 'dependencies' to better mimic OpenMLFlow

* Ci python 38 (#1220)

* Install custom numpy version for specific combination of Python3.8 and numpy

* Debug output

* Change syntax

* move to coverage action v3

* Remove test output

* added additional task agnostic local result to print of run

* add PR to progress.rst

* fix comment typo

* Update openml/runs/run.py

Co-authored-by: Matthias Feurer <lists@matthiasfeurer.de>

* add a function to list available estimation procedures

* refactor print to only work for supported task types and local measures

* add test for pint out and update progress

* added additional task agnostic local result to print of run

* add PR to progress.rst

* add type hint for new function

* update add description

* fix run doc string

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Matthias Feurer <lists@matthiasfeurer.de>
Co-authored-by: Matthias Feurer <feurerm@informatik.uni-freiburg.de>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vishal Parmar <vishalm524112@gmail.com>
Co-authored-by: Pieter Gijsbers <p.gijsbers@tue.nl>
  • Loading branch information
6 people authored Mar 1, 2023
commit ce82fd50ac209c4e41e4478e7742cec39c1853dd
3 changes: 3 additions & 0 deletions doc/progress.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ Changelog
0.13.1
~~~~~~

* Add new contributions here.
* ADD#1144: Add locally computed results to the ``OpenMLRun`` object's representation.
* FIX #1197 #559 #1131: Fix the order of ground truth and predictions in the ``OpenMLRun`` object and in ``format_prediction``.
* FIX #1198: Support numpy 1.24 and higher.
* ADD#1144: Add locally computed results to the ``OpenMLRun`` object's representation if the run was created locally and not downloaded from the server.

0.13.0
~~~~~~
Expand Down
33 changes: 33 additions & 0 deletions openml/evaluations/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,39 @@ def list_evaluation_measures() -> List[str]:
return qualities


def list_estimation_procedures() -> List[str]:
"""Return list of evaluation procedures available.

The function performs an API call to retrieve the entire list of
evaluation procedures' names that are available.

Returns
-------
list
"""

api_call = "estimationprocedure/list"
xml_string = openml._api_calls._perform_api_call(api_call, "get")
api_results = xmltodict.parse(xml_string)

# Minimalistic check if the XML is useful
if "oml:estimationprocedures" not in api_results:
raise ValueError("Error in return XML, does not contain " '"oml:estimationprocedures"')
if "oml:estimationprocedure" not in api_results["oml:estimationprocedures"]:
raise ValueError("Error in return XML, does not contain " '"oml:estimationprocedure"')

if not isinstance(api_results["oml:estimationprocedures"]["oml:estimationprocedure"], list):
raise TypeError(
"Error in return XML, does not contain " '"oml:estimationprocedure" as a list'
)

prods = [
prod["oml:name"]
for prod in api_results["oml:estimationprocedures"]["oml:estimationprocedure"]
]
return prods


def list_evaluations_setups(
function: str,
offset: Optional[int] = None,
Expand Down
80 changes: 66 additions & 14 deletions openml/runs/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


class OpenMLRun(OpenMLBase):
"""OpenML Run: result of running a model on an openml dataset.
"""OpenML Run: result of running a model on an OpenML dataset.

Parameters
----------
Expand All @@ -39,13 +39,13 @@ class OpenMLRun(OpenMLBase):
setup_string: str
The setup string of the run.
output_files: Dict[str, str]
Specifies where each related file can be found.
Specifies where each related file can be found.
setup_id: int
An integer representing the ID of the setup used for the run.
tags: List[str]
Representing the tags associated with the run.
uploader: int
User ID of the uploader.
User ID of the uploader.
uploader_name: str
The name of the person who uploaded the run.
evaluations: Dict
Expand All @@ -71,15 +71,18 @@ class OpenMLRun(OpenMLBase):
predictions_url: str
The URL of the predictions file.
task: OpenMLTask
An instance of the OpenMLTask class, representing the OpenML task associated with the run.
An instance of the OpenMLTask class, representing the OpenML task associated
with the run.
flow: OpenMLFlow
An instance of the OpenMLFlow class, representing the OpenML flow associated with the run.
An instance of the OpenMLFlow class, representing the OpenML flow associated
with the run.
run_id: int
The ID of the run.
description_text: str, optional
Description text to add to the predictions file. If left None, is set to the time the arff file is generated.
Description text to add to the predictions file. If left None, is set to the
time the arff file is generated.
run_details: str, optional (default=None)
Description of the run stored in the run meta-data.
Description of the run stored in the run meta-data.
"""

def __init__(
Expand Down Expand Up @@ -158,8 +161,37 @@ def predictions(self) -> pd.DataFrame:
def id(self) -> Optional[int]:
return self.run_id

def _evaluation_summary(self, metric: str) -> str:
"""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))

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 @@ -175,6 +207,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 @@ -183,13 +219,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 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)

if "usercpu_time_millis" in self.fold_evaluations:
# Runtime should be available for most tasks types
rt_field = "Local Runtime - ms (+- STD)"
fields[rt_field] = self._evaluation_summary("usercpu_time_millis")
order.append(rt_field)

# determines the remaining order
order += [
"Run ID",
"Run URL",
"Task ID",
Expand Down
8 changes: 8 additions & 0 deletions tests/test_runs/test_run_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,14 @@ def determine_grid_size(param_grid):

# todo: check if runtime is present
self._check_fold_timing_evaluations(run.fold_evaluations, 1, num_folds, task_type=task_type)

# Check if run string and print representation do not run into an error
# The above check already verifies that all columns needed for supported
# representations are present.
# Supported: SUPERVISED_CLASSIFICATION, LEARNING_CURVE, SUPERVISED_REGRESSION
str(run)
self.logger.info(run)

return run

def _run_and_upload_classification(
Expand Down