Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maximize the output of a built neural net( by pytorch) with continuous and discrete/integer variables #220

Open
AmosJoseph opened this issue Jul 14, 2023 · 5 comments
Labels
question Further information is requested

Comments

@AmosJoseph
Copy link

Hi, can this library be used to maximize the output of a well-built neural net( by pytorch) with continuous and discrete/integer (1, 2, 3 ) variables?

Is there any example?

Best!

@ahmedfgad ahmedfgad added the question Further information is requested label Jul 14, 2023
@ahmedfgad
Copy link
Owner

It can train models built in Keras and PyTorch.

Here you can find examples for training PyTorch models: https://github.com/ahmedfgad/GeneticAlgorithmPython/tree/master/examples/TorchGA

@AmosJoseph
Copy link
Author

AmosJoseph commented Jul 14, 2023 via email

@ahmedfgad
Copy link
Owner

Do you you mean change the inputs (not the neural network itself) so that their outputs are accurate? If this is the case, then yes it can be done. Although there is no example yet, it can be developed easily.

@AmosJoseph
Copy link
Author

AmosJoseph commented Jul 14, 2023 via email

@ahmedfgad
Copy link
Owner

Sorry for the long time to follow up. Just decided to reply in case it would still be helpful even for someone else.

Then what evolves is the inputs. Here are the steps:

  1. Set the num_genes parameter to the length of a single input.
  2. Inside the fitness function, pass the input to the neural network to return the predicted output.
  3. Calculate the fitness by comparing the predicted and desired outputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants