Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b3b7867
Create first section: Creating Custom Flow
PGijsbers Jul 7, 2020
19d79d7
Add Section: Using the Flow
PGijsbers Jul 7, 2020
208f6cd
Allow run description text to be custom
PGijsbers Jul 10, 2020
2247bbc
Draft for Custom Flow tutorial
PGijsbers Jul 10, 2020
326510c
Add minimal docstring to OpenMLRun
PGijsbers Jul 10, 2020
872bd75
Process code review feedback
PGijsbers Jul 10, 2020
c3a5326
Use the format utility function in automatic runs
PGijsbers Jul 10, 2020
a7cb290
Process @mfeurer feedback
PGijsbers Jul 13, 2020
e5dcaf0
Rename arguments of list_evaluations (#933)
Bilgecelik Jul 14, 2020
1670050
adding config file to user guide (#931)
marcoslbueno Jul 14, 2020
9c93f5b
Edit api (#935)
sahithyaravi Jul 23, 2020
666ca68
Adding support for scikit-learn > 0.22 (#936)
Neeratyoy Aug 3, 2020
5d9c69c
Add flake8-print in pre-commit (#939)
22quinn Aug 3, 2020
7d51a76
Fix edit api (#940)
sahithyaravi Aug 7, 2020
75a5440
Update subflow paragraph
PGijsbers Aug 12, 2020
23a08ab
Check the ClassificationTask has class label set
PGijsbers Aug 14, 2020
95d1fcb
Test task is of supported type
PGijsbers Aug 17, 2020
41aa789
Add tests for format_prediction
PGijsbers Aug 17, 2020
5d2e0ce
Adding Python 3.8 support (#916)
Neeratyoy Aug 17, 2020
5ef24ab
Process feedback Neeratyoy
PGijsbers Aug 25, 2020
1ce5a12
Test Exception with Regex
PGijsbers Aug 28, 2020
f70c720
change edit_api to reflect server (#941)
sahithyaravi Aug 31, 2020
f8839de
Create first section: Creating Custom Flow
PGijsbers Jul 7, 2020
2a6903b
Add Section: Using the Flow
PGijsbers Jul 7, 2020
4802497
Allow run description text to be custom
PGijsbers Jul 10, 2020
7fb64b4
Draft for Custom Flow tutorial
PGijsbers Jul 10, 2020
a6f0a38
Add minimal docstring to OpenMLRun
PGijsbers Jul 10, 2020
3748ae0
Process code review feedback
PGijsbers Jul 10, 2020
5479d7b
Use the format utility function in automatic runs
PGijsbers Jul 10, 2020
4b71c30
Process @mfeurer feedback
PGijsbers Jul 13, 2020
942d66e
Update subflow paragraph
PGijsbers Aug 12, 2020
9ba363e
Check the ClassificationTask has class label set
PGijsbers Aug 14, 2020
a72053d
Test task is of supported type
PGijsbers Aug 17, 2020
de31490
Add tests for format_prediction
PGijsbers Aug 17, 2020
832f437
Process feedback Neeratyoy
PGijsbers Aug 25, 2020
3cc74de
Test Exception with Regex
PGijsbers Aug 28, 2020
03e1e8b
Merge branch 'feature_#753' of https://github.com/openml/openml-pytho…
PGijsbers Sep 1, 2020
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 tests for format_prediction
  • Loading branch information
PGijsbers committed Aug 17, 2020
commit 41aa789363100d0d911da07312dc81de64bfb5ce
46 changes: 42 additions & 4 deletions tests/test_runs/test_run_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@

import openml.extensions.sklearn
from openml.testing import TestBase, SimpleImputer
from openml.runs.functions import (
_run_task_get_arffcontent,
run_exists,
)
from openml.runs.functions import _run_task_get_arffcontent, run_exists, format_prediction
from openml.runs.trace import OpenMLRunTrace
from openml.tasks import TaskTypeEnum

Expand Down Expand Up @@ -1336,3 +1333,44 @@ def test_run_flow_on_task_downloaded_flow(self):
run.publish()
TestBase._mark_entity_for_removal("run", run.run_id)
TestBase.logger.info("collected from {}: {}".format(__file__.split("/")[-1], run.run_id))

def test_format_prediction_non_supervised(self):
# non-supervised tasks don't exist on the test server
openml.config.server = self.production_server
clustering = openml.tasks.get_task(126033, download_data=False)
ignored_input = [0] * 5
with self.assertRaises(TypeError):
format_prediction(clustering, *ignored_input)

def test_format_prediction_classification_no_probabilities(self):
classification = openml.tasks.get_task(self.TEST_SERVER_TASK_SIMPLE[0], download_data=False)
ignored_input = [0] * 5
with self.assertRaises(ValueError):
Comment thread
PGijsbers marked this conversation as resolved.
Outdated
format_prediction(classification, *ignored_input, proba=None)

def test_format_prediction_classification_incomplete_probabilities(self):
classification = openml.tasks.get_task(self.TEST_SERVER_TASK_SIMPLE[0], download_data=False)
ignored_input = [0] * 5
incomplete_probabilities = {c: 0.2 for c in classification.class_labels[1:]}
with self.assertRaises(ValueError):
Comment thread
PGijsbers marked this conversation as resolved.
Outdated
format_prediction(classification, *ignored_input, proba=incomplete_probabilities)

def test_format_prediction_task_without_classlabels_set(self):
classification = openml.tasks.get_task(self.TEST_SERVER_TASK_SIMPLE[0], download_data=False)
classification.class_labels = None
ignored_input = [0] * 5
with self.assertRaises(ValueError):
Comment thread
PGijsbers marked this conversation as resolved.
Outdated
format_prediction(classification, *ignored_input, proba={})

def test_format_prediction_task_learning_curve_sample_not_set(self):
learning_curve = openml.tasks.get_task(801, download_data=False)
probabilities = {c: 0.2 for c in learning_curve.class_labels}
ignored_input = [0] * 5
with self.assertRaises(ValueError):
Comment thread
PGijsbers marked this conversation as resolved.
Outdated
format_prediction(learning_curve, *ignored_input, sample=None, proba=probabilities)

def test_format_prediction_task_regression(self):
regression = openml.tasks.get_task(self.TEST_SERVER_TASK_REGRESSION[0], download_data=False)
ignored_input = [0] * 5
res = format_prediction(regression, *ignored_input)
self.assertListEqual(res, [0] * 5)