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

Fix the pickle error when dumping an estimator #140

Merged
merged 3 commits into from
Sep 20, 2023

Conversation

imxtx
Copy link
Contributor

@imxtx imxtx commented Sep 8, 2023

This fix #83. When saving an estimator, the dump method will report an error due to module class members and lambda functions.

Solved two issues:

  1. Pickle does dot support dumping module objects. There is no need to put the creator as a class member of GASearchCV and GAFeatureSelectionCV.
  2. Lambda creates anonymous function objects that don't have names and can't be found by the pickle loader. See https://stackoverflow.com/a/72339613.

@codecov
Copy link

codecov bot commented Sep 19, 2023

Codecov Report

Merging #140 (94d0435) into master (7e62418) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #140   +/-   ##
=======================================
  Coverage   98.42%   98.42%           
=======================================
  Files          25       25           
  Lines        1016     1016           
=======================================
  Hits         1000     1000           
  Misses         16       16           
Files Changed Coverage Δ
sklearn_genetic/genetic_search.py 98.60% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Owner

@rodrigo-arenas rodrigo-arenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hI @imxtx It looks good, the only change I'd request is to rename the function from getter_fittness_values to ind_fitness_values, just to a keep track of the names from the DEAP package
Thanks!

@imxtx
Copy link
Contributor Author

imxtx commented Sep 19, 2023 via email

Rename the function from getter_fittness_values to ind_fitness_values to a keep track of the names from the DEAP package
@rodrigo-arenas rodrigo-arenas merged commit 9a2e973 into rodrigo-arenas:master Sep 20, 2023
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Save an evolved_estimator?
2 participants