Skip to content
Merged
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
example
  • Loading branch information
sahithyaravi committed Jul 23, 2020
commit 65666b13413e600cea5ae73436a33c9a8855c9d8
2 changes: 1 addition & 1 deletion doc/progress.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Changelog

0.11.0
~~~~~~

* ADD #929: Add data edit API
* FIX #873: Fixes an issue which resulted in incorrect URLs when printing OpenML objects after
switching the server.
* FIX #885: Logger no longer registered by default. Added utility functions to easily register
Expand Down
43 changes: 40 additions & 3 deletions examples/30_extended/datasets_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@

How to list and download datasets.
"""
############################################################################
""

# License: BSD 3-Clauses

import openml
import pandas as pd
from openml.datasets.functions import edit_dataset, get_dataset

############################################################################
# Exercise 0
Expand Down Expand Up @@ -42,9 +43,9 @@
# * Find a dataset called 'eeg_eye_state'.
# * Find all datasets with more than 50 classes.
datalist[datalist.NumberOfInstances > 10000].sort_values(["NumberOfInstances"]).head(n=20)
############################################################################
""
datalist.query('name == "eeg-eye-state"')
############################################################################
""
datalist.query("NumberOfClasses > 50")

############################################################################
Expand Down Expand Up @@ -108,3 +109,39 @@
alpha=0.8,
cmap="plasma",
)


############################################################################
# Edit a created dataset
# =================================================
# Use test server
Comment thread
sahithyaravi marked this conversation as resolved.
Outdated
openml.config.start_using_configuration_for_example()
############################################################################
# Changes to these field edits existing version
Comment thread
sahithyaravi marked this conversation as resolved.
Outdated
data_id = edit_dataset(
564,
description="xor dataset represents XOR operation",
contributor="",
collection_date="2019-10-29 17:06:18",
original_data_url="https://www.kaggle.com/ancientaxe/and-or-xor",
paper_url="",
citation="kaggle",
language="English",
)
edited_dataset = get_dataset(data_id)
print(f"Edited dataset ID: {data_id}")


############################################################################
# Changes to these fields: attributes, default_target_attribute,
Comment thread
sahithyaravi marked this conversation as resolved.
# row_id_attribute, ignore_attribute generates a new edited version

new_attributes = [
("x0", "REAL"),
("x1", "REAL"),
("y", "REAL"),
]
data_id = edit_dataset(564, attributes=new_attributes)
print(f"Edited dataset ID: {data_id}")

openml.config.stop_using_configuration_for_example()