-
-
Notifications
You must be signed in to change notification settings - Fork 270
Add feature description PR #1313
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f63d717
adds ontology functionality
janvanrijn 3c5cf6a
adds feature description
janvanrijn 95a51ff
updates functions
janvanrijn 6b10d34
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 911e9fc
updates to ontology pr
janvanrijn 18f10a7
updates to ontology pr
janvanrijn 559a874
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] af57407
Update openml/datasets/functions.py
LennartPurucker dc9408d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
updates functions
- Loading branch information
commit 95a51ff5a45b8beae8cd670bde808fbf33b0c0d5
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1060,25 +1060,68 @@ def fork_dataset(data_id: int) -> int: | |
| data_id = result["oml:data_fork"]["oml:id"] | ||
| return int(data_id) | ||
|
|
||
| def data_feature_add_ontology(did, index, ontology): | ||
| def data_feature_add_ontology(data_id, index, ontology): | ||
| """ | ||
| Adds an ontology (URL) to a given dataset feature (defined by a dataset id | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a short description of the concept of ontology in the docstring. |
||
| and index). The dataset has to exists on OpenML and needs to have been | ||
| processed by the evaluation engine. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| data_id : int | ||
| id of the dataset to which the feature belongs | ||
|
|
||
| index : int | ||
| index of the feature in dataset (0-based) | ||
|
LennartPurucker marked this conversation as resolved.
|
||
|
|
||
| ontology : str | ||
| URL to ontology (max. 256 characters) | ||
|
|
||
| Returns | ||
| ------- | ||
| True or throws an OpenML server exception | ||
| """ | ||
| upload_data = { | ||
| 'data_id': did, | ||
| 'data_id': data_id, | ||
| 'index': index, | ||
| 'ontology': ontology | ||
| } | ||
| print(upload_data) | ||
| result_xml = openml._api_calls._perform_api_call("data/feature/ontology/add", "post", data=upload_data) | ||
| print(result_xml) | ||
| openml._api_calls._perform_api_call("data/feature/ontology/add", "post", data=upload_data) | ||
| # an error will be thrown in case the request was unsuccessful | ||
| return True | ||
|
|
||
|
|
||
| def data_feature_remove_ontology(data_id, index, ontology): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add typing |
||
| """ | ||
| Removes an existing ontology (URL) to a given dataset feature (defined | ||
| by a dataset id and index). The dataset has to exists on OpenML and needs | ||
| to have been processed by the evaluation engine. Ontology needs to be | ||
| attached to the specific fearure. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| data_id : int | ||
| id of the dataset to which the feature belongs | ||
|
|
||
| index : int | ||
| index of the feature in dataset (0-based) | ||
|
|
||
| ontology : str | ||
| URL to ontology (max. 256 characters) | ||
|
|
||
| Returns | ||
| ------- | ||
| True or throws an OpenML server exception | ||
| """ | ||
|
|
||
| def data_feature_remove_ontology(did, index, ontology): | ||
| upload_data = { | ||
| 'data_id': did, | ||
| 'data_id': data_id, | ||
| 'index': index, | ||
| 'ontology': ontology | ||
| } | ||
| result_xml = openml._api_calls._perform_api_call("data/feature/ontology/remove", "post", data=upload_data) | ||
| print(result_xml) | ||
| openml._api_calls._perform_api_call("data/feature/ontology/remove", "post", data=upload_data) | ||
| # an error will be thrown in case the request was unsuccessful | ||
| return True | ||
|
|
||
|
|
||
| def _topic_add_dataset(data_id: int, topic: str) -> int: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Requires type hints and return type