openml / openml/OpenML

Run(s?) have multiple datasets associated with them

Open
#1,182 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
755
Forks
128
PR merge metrics
No merged PRs in 30d

Description

Description

"TypeError: list indices must be integers or slices, not str" is thrown when calling get_run() and get_runs(). This occurs regardless of the value of ignore_cache.

Steps/Code to Reproduce
import openml
openml.runs.get_run(run_id=1)

or

import openml
openml.runs.get_runs(run_ids=[1, 2, 3])
Expected Results

I expected to get an OpenMLRun object or collection of OpenMLRun objects corresponding to the run_id or id's that I passed to the function call.

Actual Results
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-6-e829c181e9ab> in <module>
      1 import openml
----> 2 openml.runs.get_run(run_id=1)

~/opt/anaconda3/lib/python3.8/site-packages/openml/runs/functions.py in get_run(run_id, ignore_cache)
    724     try:
    725         if not ignore_cache:
--> 726             return _get_cached_run(run_id)
    727         else:
    728             raise OpenMLCacheException(message="dummy")

~/opt/anaconda3/lib/python3.8/site-packages/openml/runs/functions.py in _get_cached_run(run_id)
    926         run_file = os.path.join(run_cache_dir, "description.xml")
    927         with io.open(run_file, encoding="utf8") as fh:
--> 928             run = _create_run_from_xml(xml=fh.read())
    929         return run
    930 

~/opt/anaconda3/lib/python3.8/site-packages/openml/runs/functions.py in _create_run_from_xml(xml, from_server)
    811 
    812     if "oml:input_data" in run:
--> 813         dataset_id = int(run["oml:input_data"]["oml:dataset"]["oml:did"])
    814     elif not from_server:
    815         dataset_id = None

TypeError: list indices must be integers or slices, not str
Versions

macOS-10.16-x86_64-i386-64bit
Python 3.8.8 (default, Apr 13 2021, 12:59:45)
[Clang 10.0.0 ]
NumPy 1.20.1
SciPy 1.6.2
Scikit-Learn 0.24.1
OpenML 0.12.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in openml/runs/functions.py at get_run(), get_runs(), and _create_run_from_xml(), where the traceback shows dataset parsing failing. Reproduce with run_id=1 and run_ids=[1, 2, 3], then verify that runs with multiple associated datasets return OpenMLRun objects without the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.