Giter VIP home page Giter VIP logo

Comments (5)

ahmedfgad avatar ahmedfgad commented on May 10, 2024 1

Thank you. The issue with assigning None values for crossover_type and mutation_type is solved. The updated pygad.py module is available at GitHub and a new release will be published to PyPI later. Please try the updated module if there a chance.

from geneticalgorithmpython.

mathlusiverse avatar mathlusiverse commented on May 10, 2024 1

Thanks, @ahmedfgad for the quick response! Please keep up the good work.

I will test it after you make it available on your web page.

from geneticalgorithmpython.

ahmedfgad avatar ahmedfgad commented on May 10, 2024 1

Thank you.

from geneticalgorithmpython.

ahmedfgad avatar ahmedfgad commented on May 10, 2024 1

Hi @ahmedfgad thanks a lot for this wonderful tool. I tried to run the example code from

/home/sikari/Desktop/temp_proj_pygad/PYGAD/pygad.py:374: UserWarning: The percentage of genes to mutate (mutation_percent_genes=10) resutled in selecting (0) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).
If you do not want to mutate any gene, please set mutation_type=None.
if not self.suppress_warnings: warnings.warn("The percentage of genes to mutate (mutation_percent_genes={mutation_percent}) resutled in selecting ({mutation_num}) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).\nIf you do not want to mutate any gene, please set mutation_type=None.".format(mutation_percent=mutation_percent_genes, mutation_num=mutation_num_genes))

solution, solution_fitness, solution_idx = ga_instance.best_solution()
print("Parameters of the best solution : {solution}".format(solution=solution))
Parameters of the best solution : [ 4.46054413 -0.56253708 -0.58246418 1.96274254 -2.26517722 1.62457641]
print("Fitness value of the best solution = {solution_fitness}".format(solution_fitness=solution_fitness))
Fitness value of the best solution = 42.05377974846767

`

Hi @asishadhikari ,

This is a normal warning and you can supress all warnings by setting suppress_warnings=True.

The warning is returned because you use the default of mutating 10% of the genes (mutation_percent_genes=10). When you have few genes like only 2, then 10% means 0.2 genes which is rounded to 0. This means you are mutating 0 genes. With that situation, the number of genes is raised to 1 automatically.

This warning tells you that if you intentionally want to mutate no genes, then it is better to set mutation_type=None. Otherwise, there will be 1 gene mutated.

Please let me know if I should clarify something.

from geneticalgorithmpython.

ahmedfgad avatar ahmedfgad commented on May 10, 2024

This issue is solved in the new release of PyGAD 2.14.0.
Thank you.

from geneticalgorithmpython.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.