Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility between SynthCity and scikit_learn 1.4. With workaround and possible fix #249

Closed
MarkJacksonRG opened this issue Jan 19, 2024 · 1 comment
Assignees
Labels
dependencies Pull requests that update a dependency file

Comments

@MarkJacksonRG
Copy link

Description

I think there's an incompatibility between synthcity and the new 1.4 version of scikit_learn?

How to Reproduce

I tried running the 'load and run a tabular generator' bit from the docs and got an error.
OneHotEncoder.__init__() got an unexpected keyword 'sparse'

Click to view screenshot of code and error:

image

Expected Behavior

It should fit the model without an error

Workaround

The OneHotEncoder docs say sparse was renamed to sparse_output. The new parameter was introduced in scikit_learn 1.2 and the old one removed in scikit_learn 1.4.

I fixed my local installation by downgrading scikit_learn to 1.3.2.
pip install --upgrade scikit_learn==1.3.2

Possible fix

I checked the stack trace and I think it might be possible to fix it with a one-line change. I haven't actually tried it! I'm not setup as a contributor.

Change sparse to sparse_output in line 63 in tabular_encoder.py : I.e. this line

cat_encoder_params: dict = dict(handle_unknown="ignore", sparse=False)

I thought I would flag it here in case it's something the community want to fix. I think you'd need to require scikit_learn 1.2 and greater.

System Information

  • OS: Windows 10
  • Python 3.10
@robsdavis
Copy link
Contributor

Hi MarkJacksonRG, Many thanks for your issue! This has now been resolved in the manner you described. This can been seen in #253. If you should ever want to contribute in the future it is very easy (see CONTRIBUTING.MD)!

@robsdavis robsdavis self-assigned this Feb 5, 2024
@robsdavis robsdavis added the dependencies Pull requests that update a dependency file label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

2 participants