Comments (13)
Hi Yili,
Thanks for your interest in this project.
In the last few weeks, some major changes to the project were introduced. Thus, the code used in the tutorial is a bit different from that currently available in the root directory of the project. For example, there is no function with the name cal_pop_fitness()
because this function is now built by the user as it changes from one problem to another.
To keep the tutorial code accessible, a new directory named Tutorial Project is created in which the files of the tutorial will be available. In a few minutes, the tutorial will be updated to reflect that the code of the tutorial is no longer under the root directory of the project but under the Tutorial Project directory.
In case there are any doubts, please let me know.
Good luck,
Ahmed
from geneticalgorithmpython.
Hi Ahmed,
Thanks for the reply!
I am a bit confused tho. I didn't see any update in either tutorial or the pygad.py. Also, in your code of pygad.py, cal_pop_fitness()
does still exist.
In addition, I even got the SyntaxError when installing the library by running pip install pygad
...
Wish to hear back from you.
Thanks,
-Yili
from geneticalgorithmpython.
Hi Yili,
Thanks for leaving another reply!
The tutorial is updated and it mentions at the beginning that the code of the tutorial is not available at the root directory of the GitHub project but inside the Tutorial Project directory. The next screenshot is from the tutorial:
Even the call_pop_fitness()
is available in pygad.py
, the actual implementation is not inside the pygad.py
module. The user writes a function in a script and call_pop_fitness()
just calls this user-defined function. But in the code of the tutorial, the call_pop_fitness()
function is implemented inside the ga.py
module.
Regarding the SyntaxError, could you please give more information like the error log or a screenshot?
Best regards,
Ahmed
from geneticalgorithmpython.
Hi Ahmed,
I really appreciate your reply.
Below is the error I encountered. Do you possibly know why it happened?
Thanks,
-Yili
from geneticalgorithmpython.
Hi Yili,
To execute a command from a Jupyter notebook as a terminal command, just prefix the command with !
. So, this command should work:
!pip install pygad
Please reply whether it works or not and I will try to help.
Regards,
Ahmed
from geneticalgorithmpython.
Hi Ahmed,
Thanks for the reply! Yeah, it works now, but it is also weird tho, for the first time I ran it without "!" it actually worked...
Anyways, I followed you example here: https://github.com/ahmedfgad/GeneticAlgorithmPython/blob/master/example.py; however, I got an error:
I looked at your source code here: https://github.com/ahmedfgad/GeneticAlgorithmPython/blob/master/pygad.py, and found the argument "init_range_low" does exist in your initial definitions. Do you know why this err happens?
Looking forward to your reply!
Thanks,
-Yili
from geneticalgorithmpython.
Hi I tried to delete
init_range_low = init_range_low,
init_range_high = init_range_high,
and the example model worked.
In your source code, I wonder if the problem was caused by this line of code:
# Initializing the population.
self.initialize_population(self.init_range_low, self.init_range_high)
for it seems to be redundant as you define a function with exactly the same name following to it..
thoughts?
Best,
-Yili
from geneticalgorithmpython.
Hi Yili,
Please note that the 2 parameters init_range_low
and init_range_high
are added into PyGAD 1.0.18 and higher.
Please make sure you are using the latest version of PyGAD.
If you are using the pip
installation of PyGAD, then please update PyGAD to its latest version (1.0.19 is the latest version up to this date (9 May 2020)):
pip install pygad==1.0.19
If you are using the GitHub source code, then please download the latest code.
Please keep me updated if your problem is solved and happy to receive more from you.
Regards,
Ahmed
from geneticalgorithmpython.
Hi Ahmed,
Thanks!
I upgraded the pygad version into the most updated one, but the exactly same error still exists in the colab...
Then, I tried to comment out
init_range_low = init_range_low,
init_range_high = init_range_high,
and continue to see if there were other error exist, and I found:
Then I further commented out:
best_solution, best_solution_fitness = ga_instance.best_soution()
print("Parameters of the best solution: ", best_solution)
print("Fitness value of the best solution: ", best_solution_fitness, "\n")
After that, the example code ran through in colab without any error any more.
Looking forward to your reply!
-Yili
from geneticalgorithmpython.
Hi Yili,
Thanks for your feedback that the problem already exists.
I made a test to Colab and deduced where is the issue.
I just pushed PyGAD 1.0.20 which is tested and working properly.
Please do the following for making PyGAD work for Colab:
pip uninstall pygad
pip install pygad==1.0.20
After uninstalling and installing PyGAD 1.0.20, I think the previous errors will be solved.
At all, I am available in case they're still some issue.
Regards,
Ahmed
from geneticalgorithmpython.
Hi Ahmed,
Thanks! It all works now.
In addition, I would like to confirm with you if the code in PyPI pygad 1.0.20 is consistent with the code in github:
https://github.com/ahmedfgad/GeneticAlgorithmPython/blob/master/pygad.py
since I would like to take some time going through your source code to learn your elegant algorithm designs.
Moreover, I may need to do some change to your source code to adapt into my own project (e.g., crossover/mutation type and etc.)...I wonder if there would be a way to upload the package with specifically-adjusted code onto the PyPI so that all my project members can conveniently use them by pipping the library? I mean, how could I do it without violating your copyright or anything equivalent?
I highly appreciate your help, and am looking forward to your reply!
Best Regards,
-Yili
from geneticalgorithmpython.
Hi Yili,
Great!
I did not decide yet under which license I will share the project. So, please give me time until reaching a decision.
Regards,
Ahmed
from geneticalgorithmpython.
Hi Ahmed,
Thank for the prompt reply!
I totally understand, and I am willing to wait for your decision. To be honest, this project is my Master's thesis project and I am graduating in a couple of months, so I wish I could hear you back sooner!
Respectfully,
-Yili
from geneticalgorithmpython.
Related Issues (20)
- Convergence issue: good solution appears to be forgotten, resulting best solution is not even valid HOT 1
- Error when running 3.2.0 vs. 3.1.0 for ga_instance.best_solutions HOT 1
- ga_instance.save will not work with tqdm example HOT 2
- fitness function is being saved? HOT 2
- Cannot modify the attributes of the ga_instance when running multiple processes in parallel HOT 1
- Manipulate solution before saving it as parent HOT 5
- `pareto_fronts` is from previous generation HOT 1
- `initial_population` not effectively used/retained for multiobjective problems? HOT 4
- Training traffic sign recognition with faster rcnn using ga HOT 1
- ga_instance.best_solution() does not return the solution that minimizes my fitness function HOT 2
- delay_after_gen warning HOT 3
- Is NSGA-III supported? HOT 1
- Caching of Fitness Values for Elites/Kept Parents
- pygad.kerasga
- ga_instance.best_solution() only returning best parameters and fitness of previous Generation HOT 1
- Matplotlib imported by pyGAD
- 'numpy.ndarray' object has no attribute 'index'
- Multi-objective optimization with NSGA II throwing out solutions in Pareto front HOT 1
- Adaptive mutation will call fitness batch function twice HOT 1
- "reach" stop criteria with negative valued fitness function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geneticalgorithmpython.