Caparrini / mloptimizer

mloptimizer is an optimizing library designed to be used with sklearn interface machine learning algorithms. It uses deap library for genetic algorithm optimization of hyperparameters.
MIT License
5 stars 2 forks source link

A class named 'FitnessMax' has already been created and it will be overwritten. #21

Closed Caparrini closed 1 month ago

Caparrini commented 1 month ago

Description

When two genetic executions are run one after the other, a runtime warning occurs in DEAP:

RuntimeWarning: A class named 'FitnessMax' has already been created and it will be overwritten. Consider deleting the previous creation of that class or rename it.
/home/paradox/.local/lib/python3.10/site-packages/deap/creator.py:185: RuntimeWarning:

Steps to Reproduce

  1. Run a genetic execution using DEAP.
  2. Without restarting the environment, run a second genetic execution.
  3. Observe the runtime warning mentioned above.

Expected Behavior

The second execution should proceed without any warnings or errors related to class creation.

Actual Behavior

A runtime warning is issued indicating that a class named FitnessMax has already been created and will be overwritten.

Possible Solutions

Additional Context

This issue seems to arise due to the reuse of the DEAP creator module without proper cleanup or checks for existing classes.