Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork495
-
Accept that parameters Line 339: |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 3 comments 6 replies
-
Thanks for opening this conversation. PyGAD 2.16.0 is released right now to support this feature. This is the release note: The example_custom_operators.py script in the GitHub project gives an example of building and using custom functions for the 3 operators. Please let me know if you have any other feature to be supported. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Thanks, that is great. You may also want to add to the documentation the integration with fromtqdmimporttqdmnum_generations=100withtqdm(total=num_generations)aspbar:ga_instance=pygad.GA(num_generations=num_generations, ...,on_generation=lambda_:pbar.update(1), )ga_instance.run() |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 2
-
That is really helpful! Thank you. I will definitely refer to this discussion in the documentation. It is so fast in monitoring the progress compared to printing the the generation number in a new function. Please let me know if you have any other suggestion or bugs to fix. |
BetaWas this translation helpful?Give feedback.
All reactions
-
Hi & thanks for this great tool. Regards |
BetaWas this translation helpful?Give feedback.
All reactions
-
Thanks@dayd! The issue is solved by defining a function. The following code works: importpygadimportnumpyimporttqdmequation_inputs= [4,-2,3.5]desired_output=44deffitness_func(solution,solution_idx):output=numpy.sum(solution*equation_inputs)fitness=1.0/ (numpy.abs(output-desired_output)+0.000001)returnfitnessdefon_generation_progress(ga):pbar.update(1)num_generations=100withtqdm.tqdm(total=num_generations)aspbar:ga_instance=pygad.GA(num_generations=num_generations,sol_per_pop=5,num_parents_mating=2,num_genes=len(equation_inputs),fitness_func=fitness_func,on_generation=on_generation_progress)ga_instance.run()ga_instance.plot_result()ga_instance.save("test") |
BetaWas this translation helpful?Give feedback.
All reactions
-
Thanks, that's perfect and works like a charm. |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Hello, I am using the PyGAD library for the clustering task. I wanted to use a custom crossover operator, therefore I tried checking the linghttps://pygad.readthedocs.io/en/latest/README_pygad_ReadTheDocs.html#user-defined-crossover-mutation-and-parent-selection-operators, though it seems it got deleted. Was it move somewhere else? |
BetaWas this translation helpful?Give feedback.
All reactions
-
I assume that you would have found it already, but since I was looking for the same when arrived to this thread, I leave the link for the future: |
BetaWas this translation helpful?Give feedback.
All reactions
❤️ 3
-
Thank you very much for the support.Antonio PolitanoDa: priack ***@***.***>Inviato: venerdì 5 gennaio 2024 12:15A: ahmedfgad/GeneticAlgorithmPython ***@***.***>Cc: POLITANO ANTONIO ***@***.***>; Comment ***@***.***>Oggetto: Re: [ahmedfgad/GeneticAlgorithmPython] Accept user defined functions for crossover and mutate (Discussion#50)I assume that you would have found it already, but since I was looking for the same when arrived to this thread, I leave the link for the future:https://pygad.readthedocs.io/en/latest/utils.html#user-defined-crossover-mutation-and-parent-selection-operators-Reply to this email directly, view it on GitHub<#50 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ANITL4OJXLRYNXVYMVBKPP3YM7OERAVCNFSM465MQ2JKU5DIOJSWCZC7NNSXTOKENFZWG5LTONUW63SDN5WW2ZLOOQ5TQMBSGIYDSOI>.You are receiving this because you commented.Message ID: ***@***.***> |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1