neuroevolution-ai / NeuroEvolution-CTRNN_new

MIT License
3 stars 3 forks source link

Fixes Seed inconsistency among workers #45

Closed pdeubel closed 3 years ago

pdeubel commented 3 years ago

Replaced random with np.random to generate random Integers. Oddly enough this fixes different results in the TestExperiment.test_run() test case, maybe random does not work well with parallel processing.

Note that I removed all accepted_results and inserted two new ones, which should be the correct ones:

accepted_results = [
    -103.4065390603272,  # standard NumPy
    -102.16727461334207  # NumPy + MKL
]

The first is for using standard NumPy and the other is NumPy with the Intel Math Kernel Library. Seems like that Intel MKL does some things that change the results.

I tested the values by creating three new conda environments with Python3.6, Python3.7 and Python3.8 respectively. I simply executed pip install --upgrade -r requirements.txt for the setup and changed nothing else on the environments. Then I executed the test case and got the first value for every environment. Then I did pip uninstall numpy followed by a conda install numpy which installs NumPy with MKL extensions. After executing the test case I got the second value for each environment.

@bjuergens Could you test if you have the same value when you checkout this branch? What Python version are you using? Do you use Intel MKL?

bjuergens commented 3 years ago

kann reviewt/germergt werden?

pdeubel commented 3 years ago

Ne noch nicht -> habs in Draft umgewandelt

pdeubel commented 3 years ago

Bzw siehe https://github.com/neuroevolution-ai/NeuroEvolution-CTRNN_new/pull/46#issuecomment-760391580

bjuergens commented 3 years ago

habs in Draft umgewandelt

cool. wusste garnicht , dass das geht

willst du hier noch etwas konkretes implementieren/ändern? Falls nein, würde ich das einfach schonmal reinmergen

pdeubel commented 3 years ago

Ich teste noch ein zwei Sachen ansonsten merge ich einfach und schreibe den Wert den der Action Runner ausgibt in den Test rein -> Dann läuft der immer durch hoffentlich