ahmedfgad / GeneticAlgorithmPython

Source code of PyGAD, a Python 3 library for building the genetic algorithm and training machine learning algorithms (Keras & PyTorch).
https://pygad.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.89k stars 464 forks source link

Matplotlib imported by pyGAD #292

Open bemgreem opened 6 months ago

bemgreem commented 6 months ago

At the moment from pygad import GA causes matplotlib to be imported. Matplotlib is quite a heavy import that I'd rather avoid if possible when running some code in a limited environment.

Would you consider a conditional import of matplotlib? As in altering pygad so it imports matplotlib at the point of plotting rather than initially. Some other packages such as pandas already use this approach (running import pandas does not import matplotlib but it will be imported at the point df.plot() is called)

I know this is the sort of thing people feel strongly about. If it's palatable I could probably have a look at raising a PR but thought it was worth asking first.

chrissype commented 2 months ago

hey @ahmedfgad this would be great for me as well, any update on this one?