From 4848aca7e057b2c0237745e8b85c2e33884981c5 Mon Sep 17 00:00:00 2001 From: sahithyaravi1493 Date: Thu, 6 Aug 2020 12:25:55 +0200 Subject: [PATCH 1/3] fix edit api --- openml/datasets/functions.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/openml/datasets/functions.py b/openml/datasets/functions.py index 4446f0e90..bda02d419 100644 --- a/openml/datasets/functions.py +++ b/openml/datasets/functions.py @@ -891,10 +891,18 @@ def edit_dataset( ] ): logger.warning("Creating a new version of dataset, cannot edit existing version") + + # Get old dataset and features dataset = get_dataset(data_id) + df, y, categorical, attribute_names = dataset.get_data(dataset_format="dataframe") + attributes_old = attributes_arff_from_df(df) - decoded_arff = dataset._get_arff(format="arff") - data_old = decoded_arff["data"] + # Sparse data needs to be provided in a different format from dense data + if dataset.format == "sparse_arff": + df, y, categorical, attribute_names = dataset.get_data(dataset_format="array") + data_old = coo_matrix(df) + else: + data_old = df data_new = data if data is not None else data_old dataset_new = create_dataset( name=dataset.name, @@ -904,7 +912,7 @@ def edit_dataset( collection_date=collection_date or dataset.collection_date, language=language or dataset.language, licence=dataset.licence, - attributes=attributes or decoded_arff["attributes"], + attributes=attributes or attributes_old, data=data_new, default_target_attribute=default_target_attribute or dataset.default_target_attribute, ignore_attribute=ignore_attribute or dataset.ignore_attribute, From 953d975c4989a6eab2dcd1bc4e378e7fed402a5a Mon Sep 17 00:00:00 2001 From: sahithyaravi1493 Date: Thu, 6 Aug 2020 12:26:37 +0200 Subject: [PATCH 2/3] progress --- doc/progress.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/progress.rst b/doc/progress.rst index ef5ed6bae..48b2bd858 100644 --- a/doc/progress.rst +++ b/doc/progress.rst @@ -8,6 +8,7 @@ Changelog 0.11.0 ~~~~~~ +* ADD #929: Fix data edit API * ADD #929: Add data edit API * FIX #873: Fixes an issue which resulted in incorrect URLs when printing OpenML objects after switching the server. From 991f6ef16f50c5a9e49bc6ef4c3c86665ec6d0f6 Mon Sep 17 00:00:00 2001 From: Sahithya Ravi <44670788+sahithyaravi1493@users.noreply.github.com> Date: Thu, 6 Aug 2020 14:27:36 +0200 Subject: [PATCH 3/3] Update progress.rst --- doc/progress.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/progress.rst b/doc/progress.rst index 48b2bd858..ef5ed6bae 100644 --- a/doc/progress.rst +++ b/doc/progress.rst @@ -8,7 +8,6 @@ Changelog 0.11.0 ~~~~~~ -* ADD #929: Fix data edit API * ADD #929: Add data edit API * FIX #873: Fixes an issue which resulted in incorrect URLs when printing OpenML objects after switching the server.