Skip to content

openml.datasets.get_data() has unpredictable number of return values #402

Closed

Description

@janvanrijn

MWE:

dataset = openml.datasets.get_dataset(40978)

res = dataset.get_data(target=dataset.default_target_attribute)
print(len(res))
dataset = openml.datasets.get_dataset(2)

res = dataset.get_data(target=dataset.default_target_attribute)
print(len(res))

This depends on whether a default target attribute has been specified.

Activity

  1. PGijsbers commented on Apr 15, 2019

    @PGijsbers
    Collaborator

    The MWE does not work anymore but setting the dataset.default_target_attribute to None does reproduce the behavior. After chatting with @mfeurer we decided that the desired behavior would be to always return a tuple, with the first value to be the data except for a target, and the second to be the target or None.

  2. self-assigned this
    on Apr 15, 2019
  3. PGijsbers commented on Apr 16, 2019

    @PGijsbers
    Collaborator

    I am not sure I still like this resolution, because of it's asymmetry with return_categorical_indicator and return_attribute_names parameters. If they are left unspecified, no additional values are returned. I would prefer that a tuple is always returned if target is set (even if it is None), but not when it is not passed. Perhaps something like this would be nicer?

    • instead of a target parameter, have a separate parameter, which is False by default.
      If it is False, it behaves the same way as it currently does when set to None (i.e. no additional return value).
    • if specified (with None, str or List[str]), do behavior as above (i.e. always return a tuple, possibly with the second value being None).
  4. PGijsbers commented on Apr 16, 2019

    @PGijsbers
    Collaborator

    After discussion with @janvanrijn and @mfeurer we decided that the function should always return all four values.

  5. PGijsbers commented on Apr 27, 2019

    @PGijsbers
    Collaborator

    I'm actually going to come back to this. By version 0.9 the default is going to be Pandas Dataframes, which inherently should convey both which attributes are categorical and what their names are. How long do we want to support array output for? Should we consider two functions, e.g. one that always returns it as array (with the tuple) and the other as dataframe? And only use the array version internally (it's currently still used for run_model_on_task), until we find time to refactor that too?

  6. mfeurer commented on Apr 29, 2019

    @mfeurer
    Collaborator

    How long do we want to support array output for

    Is there a reason to drop this in the near future? I guess it makes it easier for beginners and for people working with software that doesn't support pandas out of the box (such as Auto-sklearn ;))

    Should we consider two functions, e.g. one that always returns it as array (with the tuple) and the other as dataframe?

    What would be the upside of this?

    And only use the array version internally (it's currently still used for run_model_on_task), until we find time to refactor that too?

    How far is pandas support in scikit-learn? Does it reliably work for every model and preprocessor?

  7. PGijsbers commented on Apr 29, 2019

    @PGijsbers
    Collaborator

    How far is pandas support in scikit-learn? Does it reliably work for every model and preprocessor?

    No idea, honestly.

    What would be the upside of this?

    Mostly not having two functions in one. But after having a closer look I think we can do away with a lot of the array conversions / iloc-checks that happen in the function (since we enforce the data to be in pandas anyway). Right now we need 80+ lines of code to just load data. I might have a go at refactoring the internals a little after #677 is merged.

    Is there a reason to drop this in the near future?

    I suppose not, other than maintenance. I guess it's useful for some packages (: so let's keep it

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

Metadata

Metadata

Assignees

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