dataset
openml._api.resources.dataset
#
DatasetV1API
#
DatasetV1API(http: HTTPClient, minio: MinIOClient)
Bases: ResourceV1API, DatasetAPI
Version 1 API implementation for dataset resources.
Source code in openml/_api/resources/base/base.py
add_topic
#
Adds a topic to a dataset. This API is not available for all OpenML users and is accessible only by admins.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
id of the dataset to be forked
TYPE:
|
topic
|
Topic to be added
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dataset id
|
|
Source code in openml/_api/resources/dataset.py
delete
#
Delete a resource using the V1 API.
| PARAMETER | DESCRIPTION |
|---|---|
resource_id
|
Identifier of the resource to delete.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
bool
|
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the resource type is not supported for deletion. |
OpenMLNotAuthorizedError
|
If the user is not permitted to delete the resource. |
OpenMLServerError
|
If deletion fails for an unknown reason. |
OpenMLServerException
|
For other server-side errors. |
Source code in openml/_api/resources/base/versions.py
delete_topic
#
Removes a topic from a dataset. This API is not available for all OpenML users and is accessible only by admins.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
id of the dataset to be forked
TYPE:
|
topic
|
Topic to be deleted
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dataset id
|
|
Source code in openml/_api/resources/dataset.py
download_dataset_arff
#
download_dataset_arff(description: dict | OpenMLDataset) -> Path
Download dataset arff file.
| PARAMETER | DESCRIPTION |
|---|---|
description
|
Either a dataset description as dict or OpenMLDataset.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
output_filename
|
Location of ARFF file.
TYPE:
|
Source code in openml/_api/resources/dataset.py
download_dataset_parquet
#
download_dataset_parquet(description: dict | OpenMLDataset, download_all_files: bool = False) -> Path | None
Download dataset parquet file.
| PARAMETER | DESCRIPTION |
|---|---|
description
|
Either a dataset description as dict or OpenMLDataset.
TYPE:
|
download_all_files
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path | None
|
|
Source code in openml/_api/resources/dataset.py
download_features_file
#
Download features file.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
ID of the dataset.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path
|
|
Source code in openml/_api/resources/dataset.py
download_qualities_file
#
Download qualities file.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
ID of the dataset.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path
|
|
Source code in openml/_api/resources/dataset.py
edit
#
edit(dataset_id: int, *, description: str | None = None, creator: str | None = None, contributor: str | None = None, collection_date: str | None = None, language: str | None = None, default_target_attribute: str | None = None, ignore_attribute: str | list[str] | None = None, citation: str | None = None, row_id_attribute: str | None = None, original_data_url: str | None = None, paper_url: str | None = None) -> int
Edits an OpenMLDataset.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
ID of the dataset.
TYPE:
|
description
|
Description of the dataset.
TYPE:
|
creator
|
The person who created the dataset.
TYPE:
|
contributor
|
People who contributed to the current version of the dataset.
TYPE:
|
collection_date
|
The date the data was originally collected, given by the uploader.
TYPE:
|
language
|
Language in which the data is represented. Starts with 1 upper case letter, rest lower case, e.g. 'English'.
TYPE:
|
default_target_attribute
|
The default target attribute, if it exists. Can have multiple values, comma separated.
TYPE:
|
ignore_attribute
|
Attributes that should be excluded in modelling, such as identifiers and indexes.
TYPE:
|
citation
|
Reference(s) that should be cited when building on this data.
TYPE:
|
row_id_attribute
|
The attribute that represents the row-id column, if present in the
dataset. If .. versionadded: 0.8
Inference of
TYPE:
|
original_data_url
|
For derived data, the url to the original dataset.
TYPE:
|
paper_url
|
Link to a paper describing the dataset.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dataset id
|
|
Source code in openml/_api/resources/dataset.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
feature_add_ontology
#
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.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
id of the dataset to which the feature belongs
TYPE:
|
index
|
index of the feature in dataset (0-based)
TYPE:
|
ontology
|
URL to ontology (max. 256 characters)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
True or throws an OpenML server exception
|
|
Source code in openml/_api/resources/dataset.py
feature_remove_ontology
#
Removes an existing ontology (URL) from 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.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
id of the dataset to which the feature belongs
TYPE:
|
index
|
index of the feature in dataset (0-based)
TYPE:
|
ontology
|
URL to ontology (max. 256 characters)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
True or throws an OpenML server exception
|
|
Source code in openml/_api/resources/dataset.py
fork
#
Creates a new dataset version, with the authenticated user as the new owner. The forked dataset can have distinct dataset meta-data, but the actual data itself is shared with the original version.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
id of the dataset to be forked
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Dataset id of the forked dataset
|
|
Source code in openml/_api/resources/dataset.py
get
#
get(dataset_id: int, *, download_data: bool = False, cache_format: Literal['pickle', 'feather'] = 'pickle', download_qualities: bool = False, download_features_meta_data: bool = False, download_all_files: bool = False, force_refresh_cache: bool = False) -> OpenMLDataset
Download the OpenML dataset representation, optionally also download actual data file.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
Dataset ID (integer) or dataset name (string) of the dataset to download.
TYPE:
|
download_data
|
If True, download the data file.
TYPE:
|
cache_format
|
Format for caching the dataset - may be feather or pickle Note that the default 'pickle' option may load slower than feather when no.of.rows is very high.
TYPE:
|
download_qualities
|
Option to download 'qualities' meta-data with the minimal dataset description.
TYPE:
|
download_features_meta_data
|
Option to download 'features' meta-data with the minimal dataset description.
TYPE:
|
download_all_files
|
EXPERIMENTAL. Download all files related to the dataset that reside on the server.
TYPE:
|
force_refresh_cache
|
Force the cache to delete the cache directory and re-download the data.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dataset
|
The downloaded dataset.
TYPE:
|
Source code in openml/_api/resources/dataset.py
get_features
#
get_features(dataset_id: int, force_refresh_cache: bool = False) -> dict[int, OpenMLDataFeature]
Get features of a dataset from server.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
ID of the dataset.
TYPE:
|
force_refresh_cache
|
Refresh the cache and re-download the features file.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[int, OpenMLDataFeature]
|
|
Source code in openml/_api/resources/dataset.py
get_online_dataset_format
#
Get the dataset format for a given dataset id from the OpenML website.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
A dataset id.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Dataset format. |
Source code in openml/_api/resources/dataset.py
get_qualities
#
Get qualities of a dataset from server.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
ID of the dataset.
TYPE:
|
force_refresh_cache
|
Refresh the cache and re-download the qualities file.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, float] | None
|
|
Source code in openml/_api/resources/dataset.py
list
#
Perform api call to return a list of all datasets.
| PARAMETER | DESCRIPTION |
|---|---|
The
|
|
ones
|
|
display_errors
|
|
default
|
|
limit
|
The maximum number of datasets to show.
TYPE:
|
offset
|
The number of datasets to skip, starting from the first.
TYPE:
|
data_id
|
TYPE:
|
kwargs
|
Legal filter operators (keys in the dict): tag, status, limit, offset, data_name, data_version, number_instances, number_features, number_classes, number_missing_values.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
datasets
|
TYPE:
|
Source code in openml/_api/resources/dataset.py
list_qualities
#
Return list of data qualities available.
The function performs an API call to retrieve the entire list of data qualities that are computed on the datasets uploaded.
| RETURNS | DESCRIPTION |
|---|---|
list
|
|
Source code in openml/_api/resources/dataset.py
parse_features_file
#
parse_features_file(features_file: Path, features_pickle_file: Path | None = None) -> dict[int, OpenMLDataFeature]
Parse features file (xml) and store it as a pickle file.
| PARAMETER | DESCRIPTION |
|---|---|
features_file
|
Path to features file.
TYPE:
|
features_pickle_file
|
Path to pickle file for features.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
features
|
TYPE:
|
Source code in openml/_api/resources/dataset.py
parse_qualities_file
#
parse_qualities_file(qualities_file: Path, qualities_pickle_file: Path | None = None) -> dict[str, float]
Parse qualities file (xml) and store it as a pickle file.
| PARAMETER | DESCRIPTION |
|---|---|
qualities_file
|
Path to qualities file.
TYPE:
|
qualities_pickle_file
|
Path to pickle file for qualities.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
qualities
|
TYPE:
|
Source code in openml/_api/resources/dataset.py
publish
#
Publish a new resource using the V1 API.
| PARAMETER | DESCRIPTION |
|---|---|
path
|
API endpoint path for the upload.
TYPE:
|
files
|
Files to upload as part of the request payload.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
int
|
Identifier of the newly created resource. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the server response does not contain a valid resource ID. |
OpenMLServerException
|
If the server returns an error during upload. |
Source code in openml/_api/resources/base/versions.py
status_update
#
Updates the status of a dataset to either 'active' or 'deactivated'. Please see the OpenML API documentation for a description of the status and all legal status transitions: docs.openml.org/concepts/data/#dataset-status
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
The data id of the dataset
TYPE:
|
status
|
'active' or 'deactivated'
TYPE:
|
Source code in openml/_api/resources/dataset.py
tag
#
Add a tag to a resource using the V1 API.
| PARAMETER | DESCRIPTION |
|---|---|
resource_id
|
Identifier of the resource to tag.
TYPE:
|
tag
|
Tag to associate with the resource.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list of str
|
Updated list of tags assigned to the resource. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the resource type does not support tagging. |
OpenMLServerException
|
If the server returns an error. |
Source code in openml/_api/resources/base/versions.py
untag
#
Remove a tag from a resource using the V1 API.
| PARAMETER | DESCRIPTION |
|---|---|
resource_id
|
Identifier of the resource to untag.
TYPE:
|
tag
|
Tag to remove from the resource.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list of str
|
Updated list of tags assigned to the resource. |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If the resource type does not support tagging. |
OpenMLServerException
|
If the server returns an error. |
Source code in openml/_api/resources/base/versions.py
DatasetV2API
#
DatasetV2API(http: HTTPClient, minio: MinIOClient)
Bases: ResourceV2API, DatasetAPI
Version 2 API implementation for dataset resources.
Source code in openml/_api/resources/base/base.py
download_dataset_arff
#
download_dataset_arff(description: dict | OpenMLDataset) -> Path
Download dataset arff file.
| PARAMETER | DESCRIPTION |
|---|---|
description
|
Either a dataset description as dict or OpenMLDataset.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
output_filename
|
Location of ARFF file.
TYPE:
|
Source code in openml/_api/resources/dataset.py
download_dataset_parquet
#
download_dataset_parquet(description: dict | OpenMLDataset, download_all_files: bool = False) -> Path | None
Download dataset parquet file.
| PARAMETER | DESCRIPTION |
|---|---|
description
|
Either a dataset description as dict or OpenMLDataset.
TYPE:
|
download_all_files
|
If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path | None
|
|
Source code in openml/_api/resources/dataset.py
download_features_file
#
Download features file.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
ID of the dataset.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path
|
|
Source code in openml/_api/resources/dataset.py
download_qualities_file
#
Download qualities file.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
ID of the dataset.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path
|
|
Source code in openml/_api/resources/dataset.py
get
#
get(dataset_id: int, *, download_data: bool = False, cache_format: Literal['pickle', 'feather'] = 'pickle', download_qualities: bool = False, download_features_meta_data: bool = False, download_all_files: bool = False, force_refresh_cache: bool = False) -> OpenMLDataset
Download the OpenML dataset representation, optionally also download actual data file.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
Dataset ID (integer) or dataset name (string) of the dataset to download.
TYPE:
|
download_data
|
If True, download the data file.
TYPE:
|
cache_format
|
Format for caching the dataset - may be feather or pickle Note that the default 'pickle' option may load slower than feather when no.of.rows is very high.
TYPE:
|
download_qualities
|
Option to download 'qualities' meta-data with the minimal dataset description.
TYPE:
|
download_features_meta_data
|
Option to download 'features' meta-data with the minimal dataset description.
TYPE:
|
download_all_files
|
EXPERIMENTAL. Download all files related to the dataset that reside on the server.
TYPE:
|
force_refresh_cache
|
Force the cache to delete the cache directory and re-download the data.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dataset
|
The downloaded dataset.
TYPE:
|
Source code in openml/_api/resources/dataset.py
887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 | |
get_features
#
get_features(dataset_id: int, force_refresh_cache: bool = False) -> dict[int, OpenMLDataFeature]
Get features of a dataset from server.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
ID of the dataset.
TYPE:
|
force_refresh_cache
|
Refresh the cache and re-download the features file.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[int, OpenMLDataFeature]
|
|
Dictionary mapping feature index to OpenMLDataFeature.
|
|
Source code in openml/_api/resources/dataset.py
get_online_dataset_format
#
Get the dataset format for a given dataset id from the OpenML website.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
A dataset id.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
Dataset format. |
Source code in openml/_api/resources/dataset.py
get_qualities
#
Get qualities of a dataset from server.
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
ID of the dataset.
TYPE:
|
force_refresh_cache
|
Refresh the cache and re-download the qualities file.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, float] | None
|
|
Dictionary mapping quality name to quality value.
|
|
Source code in openml/_api/resources/dataset.py
list
#
Perform api call to return a list of all datasets.
| PARAMETER | DESCRIPTION |
|---|---|
The
|
|
ones
|
|
display_errors
|
|
default
|
|
limit
|
The maximum number of datasets to show.
TYPE:
|
offset
|
The number of datasets to skip, starting from the first.
TYPE:
|
data_id
|
TYPE:
|
kwargs
|
Legal filter operators (keys in the dict): tag, status, limit, offset, data_name, data_version, number_instances, number_features, number_classes, number_missing_values.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
datasets
|
TYPE:
|
Source code in openml/_api/resources/dataset.py
list_qualities
#
Return list of data qualities available.
The function performs an API call to retrieve the entire list of data qualities that are computed on the datasets uploaded.
| RETURNS | DESCRIPTION |
|---|---|
list
|
|
Source code in openml/_api/resources/dataset.py
parse_features_file
#
parse_features_file(features_file: Path, features_pickle_file: Path | None = None) -> dict[int, OpenMLDataFeature]
Parse features file (json) and store it as a pickle file.
| PARAMETER | DESCRIPTION |
|---|---|
features_file
|
Path to features file.
TYPE:
|
features_pickle_file
|
Path to pickle file for features.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[int, OpenMLDataFeature]
|
|
Source code in openml/_api/resources/dataset.py
parse_qualities_file
#
parse_qualities_file(qualities_file: Path, qualities_pickle_file: Path | None = None) -> dict[str, float]
Parse qualities file (json) and store it as a pickle file.
| PARAMETER | DESCRIPTION |
|---|---|
qualities_file
|
Path to qualities file.
TYPE:
|
qualities_pickle_file
|
Path to pickle file for qualities.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
qualities
|
TYPE:
|
Source code in openml/_api/resources/dataset.py
status_update
#
Updates the status of a dataset to either 'active' or 'deactivated'. Please see the OpenML API documentation for a description of the status and all legal status transitions: docs.openml.org/concepts/data/#dataset-status
| PARAMETER | DESCRIPTION |
|---|---|
dataset_id
|
The data id of the dataset
TYPE:
|
status
|
'active' or 'deactivated'
TYPE:
|