Genetic algorithm and ML library that supports Keras & PyTorch.
Questions tagged [pygad]
23 questions
1
vote
1 answer
get the generation number and pass it to the fitness function PyGAD
I am trying to set up the fitness function in PyGAD but inside this I am calling and external process for each solution(individual) get the resulting data and perform the fitness. So I'll have a folder for each generation and each individual for…
1
vote
1 answer
in PyGAD how Can I get non duplicate genes eventhough I give parameter allow_duplicate_genes=False
Hi I am trying to solve a Tsp problem by using PyGAD I made a result any how but result make duplicated number
I put in initial_population:
[[ 1 12 26 19 22 20 6 15 17 23 21 7 28 5 13 14 16 2 24 4 3 10 9 8 18 25 27 11]
[ 2 17 23 27 22 12…

haonol
- 15
- 3
1
vote
1 answer
Make a prediction with Keras models trained using the Genetic Algorithm with PyGAD
I successfully run the code (original link where to find code) to train Keras Models using the Genetic Algorithm with PyGAD:
import tensorflow.keras
import pygad.kerasga
import numpy
import pygad
def fitness_func(solution, sol_idx):
global…

ah bon
- 9,293
- 12
- 65
- 148
0
votes
1 answer
Using PyGAD for feature selection
I'm trying to create a Python script for feature selection using PyGAD
My code is shown below, nonetheless, it is returning that all the features are the best subset. How can I be sure it is correct?
import pygad
import numpy
from…

SimplyhumanRight
- 1
- 2
0
votes
0 answers
Errors while using PyGAD's parallel processing for neural network training in Google Colab
I'm trying to use a PyGAD to train a Keras sequential model. Currently, it can find a solution just fine but it takes really long to do it.
I'm already using batching for the keras side, but what's killing performance is PyGAD. Just so you can get…

yna ponte
- 41
- 5
0
votes
1 answer
Why does PyGad fitness_function not work when inside of a class?
I am trying to train a genetic algorithm but for some reason it does not work when it's stored inside of a class. I have two equivalent pieces of code but the one stored inside of a class fails. It returns this..
raise ValueError("The fitness…

BennyC20
- 13
- 3
0
votes
1 answer
How to Supply named parameters in PyGAD?
I've seen the tutorial on optimizing arbitrary functions with PyGAD. As a simple POC, I'd like to implement linear regression. I am not interested in integrating with Keras or PyTorch; I understand that the integration is supported, but that's more…

jbuddy_13
- 902
- 2
- 12
- 34
-1
votes
1 answer
pygad guarantee unique points within constraints
For a project on a HPC I want to use pygad to produce sets of points that can then be passed to jobs on the cluster:
Therefore, I would like all points within a population to be unique (time on the cluster is expensive so i would like to optimally…

dmark04
- 1
- 1