Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
updates to ontology pr
  • Loading branch information
janvanrijn authored and eddiebergman committed Jan 12, 2024
commit 911e9fc015cb08ef7d10750f0ff913ec5c60aaf3
4 changes: 3 additions & 1 deletion openml/datasets/data_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class OpenMLDataFeature:
number_missing_values : int
Number of rows that have a missing value for this feature.
ontologies : list(str)
list of ontologies attached to this feature
list of ontologies attached to this feature. An ontology describes the
concept that are described in a feature. An ontology is defined by an
URL where the information is provided.
"""

LEGAL_DATA_TYPES: ClassVar[Sequence[str]] = ["nominal", "numeric", "string", "date"]
Expand Down
8 changes: 5 additions & 3 deletions openml/datasets/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,9 +1060,11 @@ def fork_dataset(data_id: int) -> int:
data_id = result["oml:data_fork"]["oml:id"]
return int(data_id)

def data_feature_add_ontology(data_id, index, ontology):
def data_feature_add_ontology(data_id: int, index: int, ontology: str) -> bool:
"""
Adds an ontology (URL) to a given dataset feature (defined by a dataset id
An ontology describes the concept that are described in a feature. An
ontology is defined by an URL where the information is provided. Adds
an 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.

Expand All @@ -1087,7 +1089,7 @@ def data_feature_add_ontology(data_id, index, ontology):
return True


def data_feature_remove_ontology(data_id, index, ontology):
def data_feature_remove_ontology(data_id: int, index: int, ontology: str) -> bool:
"""
Removes an existing ontology (URL) to a given dataset feature (defined
Comment thread
LennartPurucker marked this conversation as resolved.
Outdated
by a dataset id and index). The dataset has to exists on OpenML and needs
Expand Down