Skip to content

Exception with KeyError: 'oml:tag' when fetching benchmarks #641

Closed

Description

@bailuding

Description

I followed the instruction on https://docs.openml.org/benchmark/#openml100 to fetch the details of benchmarks. but I encountered KeyError: 'oml:tag' for both open ml 100 and openml-cc18.

I use the latest openml package and Python 3.6

Steps/Code to Reproduce

Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import openml
benchmark_suite = openml.study.get_study('OpenML-CC18','tasks')
Traceback (most recent call last):
File "", line 1, in
File "E:\Python\env\lib\site-packages\openml\study\functions.py", line 33, in get_study
for tag in _multitag_to_list(result_dict, 'oml:tag'):
File "E:\Python\env\lib\site-packages\openml\study\functions.py", line 8, in _multitag_to_list
if isinstance(result_dict[tag], list):
KeyError: 'oml:tag'

Expected Results

No error is thrown.

Actual Results

Traceback (most recent call last):
File "", line 1, in
File "E:\Python\env\lib\site-packages\openml\study\functions.py", line 33, in get_study
for tag in _multitag_to_list(result_dict, 'oml:tag'):
File "E:\Python\env\lib\site-packages\openml\study\functions.py", line 8, in _multitag_to_list
if isinstance(result_dict[tag], list):
KeyError: 'oml:tag'

Versions

Python 3.6.6, openml 0.8.0

Activity

  1. joaquinvanschoren commented on Mar 18, 2019

    @joaquinvanschoren
    Contributor

    @janvanrijn @mfeurer
    For the 'new' studies the tag that identifies the study is no longer returned (and the benchmarking studies are 'new' studies): https://www.openml.org/api/v1/study/99

    @janvanrijn: is this by design? Then the openml-python package needs to be updated (and probably other bindings as well). If not then this is likely a bug in the API?

  2. bailuding commented on Mar 19, 2019

    @bailuding
    Author

    @janvanrijn @mfeurer
    For the 'new' studies the tag that identifies the study is no longer returned (and the benchmarking studies are 'new' studies): https://www.openml.org/api/v1/study/99

    @janvanrijn: is this by design? Then the openml-python package needs to be updated (and probably other bindings as well). If not then this is likely a bug in the API?

    How can I avoid the exception and get the benchmark in Python then?

  3. janvanrijn commented on Mar 19, 2019

    @janvanrijn
    Member

    Currently, studies do no longer return tags by default (only legacy studies do, as announced in email thread on benchmark suites).

    This is indeed a problem in openmlpython not covered by the unit tests. We should update this.

  4. joaquinvanschoren commented on Mar 19, 2019

    @joaquinvanschoren
    Contributor

    OK, so what is the most practical way to proceed?
    Do we make a new minor release of the python API with a fix?
    Or do we make the server return the tag until the APIs are updated and released?

  5. joaquinvanschoren commented on Mar 19, 2019

    @joaquinvanschoren
    Contributor

    I checked and it this change doesn't affect the R API.
    @janvanrijn: I assume that you checked the Java API?
    I'll make a PR for the python API now. We still need to decide whether we do a minor release of update the REST API.

  6. mfeurer commented on Mar 19, 2019

    @mfeurer
    Collaborator

    Thanks for checking this @joaquinvanschoren

    We can also make a full release of the python API once this is integrated as there have been plenty of changes already. I guess we only need to wait for a fix to #646 prior to doing so to maintain backwards compatibility.

  7. joaquinvanschoren commented on Mar 19, 2019

    @joaquinvanschoren
    Contributor

    Well, it looks like @janvanrijn already fixed this in commit a2a4ade

    So that means that the development version should work

  8. joaquinvanschoren commented on Mar 19, 2019

    @joaquinvanschoren
    Contributor

    @bailuding To work around this, you can install the development version of the python API until we made a new release: https://openml.github.io/openml-python/master/contributing.html#installation

  9. janvanrijn commented on Mar 19, 2019

    @janvanrijn
    Member

    That PR should be in the latest release already (0.8.0) if I am not mistaken.

  10. joaquinvanschoren commented on Mar 19, 2019

    @joaquinvanschoren
    Contributor

    Hmm, I don't see it here: #617
    So I guess it's not in 0.8.0

    I added a PR with the new unit test: #649

  11. mfeurer commented on Mar 19, 2019

    @mfeurer
    Collaborator

    Fixed via #649. Please wait for the next release @bailuding for a fix on pypi.

  12. bailuding commented on Mar 19, 2019

    @bailuding
    Author

    @bailuding To work around this, you can install the development version of the python API until we made a new release: https://openml.github.io/openml-python/master/contributing.html#installation

    Hi @joaquinvanschoren

    I installed the develop branch, and the 'oml:tag' exception is gone. However, now I got another exception when trying to get the X and y:

    'numpy.ndarray' object has no attribute 'columns'
    Traceback (most recent call last):
    File ".\test.py", line 532, in download_openml_benchmark
    X, y = task.get_X_and_y() # get the data (not used in this example)
    File "E:\Python\env\lib\site-packages\openml-0.8.0-py3.6.egg\openml\tasks\task.py", line 125, in get_X_and_y
    dataset_format='array', target=self.target_name
    File "E:\Python\env\lib\site-packages\openml-0.8.0-py3.6.egg\openml\datasets\dataset.py", line 538, in get_data
    x = self._convert_array_format(x, dataset_format, attribute_names)
    File "E:\Python\env\lib\site-packages\openml-0.8.0-py3.6.egg\openml\datasets\dataset.py", line 378, in _convert_array_format
    for column_name in data.columns
    AttributeError: 'numpy.ndarray' object has no attribute 'columns'

    Do you know how I can work around this?

    Package version:
    numpy==1.15.0+mkl
    openml==0.8.0

    I am following this instruction to get the task (the Python example):

    https://docs.openml.org/benchmark/#openml100

  13. joaquinvanschoren commented on Mar 20, 2019

    @joaquinvanschoren
    Contributor

    @bailuding
    Looks like this is related to #646

    In short, you can't use cached datasets from the 0.8.0 with the development version (at least not now). Workaround is to delete your cache and try again. Most likely you just need to run:

    rm -rf ~/.openml/cache
    
  14. bailuding commented on Mar 20, 2019

    @bailuding
    Author

    rm -rf ~/.openml/cache

    @joaquinvanschoren
    Thanks for the response! I use Windows with virtualenv, and I did not find the cache directory. Where shall I look for it?

  15. joaquinvanschoren commented on Mar 20, 2019

    @joaquinvanschoren
    Contributor
  16. bailuding commented on Mar 20, 2019

    @bailuding
    Author

    It’s a hidden folder in your home directory called .openml/cache
    …
    On Wed, 20 Mar 2019 at 02:13, blding @.***> wrote: rm -rf ~/.openml/cache @joaquinvanschoren https://github.com/joaquinvanschoren Thanks for the response! I use Windows with virtualenv, and I did not find the cache directory. Where shall I look for it? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#641 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/ABpQV1ogJEHjq1l-rzVroYAPh7jwkPznks5vYYtJgaJpZM4b3XRA .

    @joaquinvanschoren

    Thanks! This works for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions