question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Do not deprecate tuple support for feature names: [FutureWarning: Feature names only support names that are all strings Got feature names with dtypes: ['tuple']. An error will be raised in 1.2.]

See original GitHub issue

Describe the workflow you want to enable

I want to be able to use MutliIndex Pandas columns for feature names. These are interpreted as tuples.

Describe your proposed solution

To allow tuples and MutliIndex` Pandas columns for features.

Describe alternatives you’ve considered, if relevant

Converting to strings each time I use sklearn but this seems very backwards since tuples can already be used in older versions.

Additional context

I and many others use pd.MultiIndex objects in our daily workflow. Modeling with sklearn using these dataframes is essential.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
thomasjpfancommented, Feb 8, 2022

I think I missed the discussion but what were the main reasons for wanting to assert string features?

Looking through the original PR, there was a lot of discussion that concluded with: https://github.com/scikit-learn/scikit-learn/pull/18010#issuecomment-896561811

With that in mind, I think we should adjust the behavior for non-string columns. I think the warning should appear only when the dtype is string + another type. Otherwise, there is no warning and no error in the future. I opened https://github.com/scikit-learn/scikit-learn/pull/22410 to address this issue.

0reactions
jolespincommented, Feb 8, 2022

@thomasjpfan thank you very much for looking into this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SKLearn warning "valid feature names" in version 1.0
Show activity on this post. It is showing error because our dataframe has feature names but we should fit the data as 2d...
Read more >
How to Fix FutureWarning Messages in scikit-learn
This can be achieved by explicitly configuring the Python warning system to ignore warning messages of a specific type, such as ignore all...
Read more >
[BUG] dealing with sklearn 1.2 deprecation warnings #2143
Got feature names with dtypes: ['float', 'str']. An error will be raised in 1.2.
Read more >
scikit-survival 0.17 released - Sebastian Pölsterl
Starting version 1.2, an error will be raised. Feature names must be in the same order as they were in fit. For more...
Read more >
sklearn.base — pyts 0.12.0 documentation - Read the Docs
__class__ new_object_params = estimator.get_params(deep=False) for name, ... default=repr The function to convert entries to strings, typically the builtin ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found