Giter VIP home page Giter VIP logo

brain-tokyo-workshop's Introduction

Brain Tokyo Workshop 🧠🗼

This repo contains research materials released by members of the Google Brain team in Tokyo.

Past Projects

Weight Agnostic Neural Networks

Code Release

Link to Article (pdf version)

Learning to Predict Without Looking Ahead: World Models Without Forward Prediction

Code Release

Link to Article (pdf version)

Neuroevolution of Self-Interpretable Agents

Code Release (Code for CarRacing Variants)

Extensions to CarRacing-v0 environment released to facilitate future research.

Link to Article (pdf version)

Modern Evolution Strategies for Creativity: Fitting Concrete Images and Abstract Concepts

Code Release

The Sensory Neuron as a Transformer: Permutation-Invariant Neural Networks for Reinforcement Learning

Code Release

Link to Article (pdf version)

Disclaimer

This is not an official Google product.

brain-tokyo-workshop's People

Contributors

agaier avatar alantian avatar dependabot[bot] avatar hardmaru avatar joaogui1 avatar kyotaco avatar lerrytang avatar maraoz avatar miffyli avatar nikhilbarhate99 avatar ttitcombe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brain-tokyo-workshop's Issues

AttentionAgent: can't run pretrained CarRacing examples because of doom problems?

I installed dependencies like the README says, first running

pip3 install -r requirements.txt

then changing gym[box2d]==0.15.3 to gym==0.9.4 and re-running pip3 install -r requirements.txt, but when I run pip3 install -r requirements.txt, I get this error:

Traceback (most recent call last):
  File "test_solution.py", line 63, in <module>
    gin.parse_config_file(os.path.join(args.log_dir, 'config.gin'))
  File "/Users/manu/anaconda3/envs/attention/lib/python3.6/site-packages/gin/config.py", line 1436, in parse_config_file
    parse_config(f, skip_unknown=skip_unknown)
  File "/Users/manu/anaconda3/envs/attention/lib/python3.6/site-packages/gin/config.py", line 1373, in parse_config
    __import__(statement.module)
  File "/Users/manu/anaconda3/envs/attention/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/Users/manu/anaconda3/envs/attention/lib/python3.6/site-packages/gin/utils.py", line 68, in try_with_location
    augment_exception_message_and_reraise(exception, _format_location(location))
  File "/Users/manu/anaconda3/envs/attention/lib/python3.6/site-packages/gin/utils.py", line 49, in augment_exception_message_and_reraise
    six.raise_from(proxy.with_traceback(exception.__traceback__), None)
  File "<string>", line 3, in raise_from
  File "/Users/manu/anaconda3/envs/attention/lib/python3.6/site-packages/gin/utils.py", line 66, in try_with_location
    yield
  File "/Users/manu/anaconda3/envs/attention/lib/python3.6/site-packages/gin/config.py", line 1373, in parse_config
    __import__(statement.module)
  File "/Users/manu/git/brain-tokyo-workshop/AttentionAgent/tasks/gym_task.py", line 10, in <module>
    from takecover_variants.doom_take_cover import DoomTakeCoverEnv
  File "/Users/manu/git/brain-tokyo-workshop/AttentionAgent/takecover_variants/doom_take_cover.py", line 2, in <module>
    from .doom_env import DoomEnv
  File "/Users/manu/git/brain-tokyo-workshop/AttentionAgent/takecover_variants/doom_env.py", line 18, in <module>
    "with 'pip install doom_py.)'".format(e))
gym.error.DependencyNotInstalled: {}. (HINT: you can install Doom dependencies with 'pip install doom_py.)'
  In file "pretrained/CarRacing/config.gin", line 4
    import tasks.gym_task

which seems Doom related.
Is there any way I can run the CarRacing example without installing doom_py? (I've tried but I couldn't get to installing it). I also don't have docker :)

Creating the initial population

Hello,

I think there is an issue with how the initial population is created at the moment. In this line np.tile should be replaced with np.repeat.

Let's assume we have 3 input (+1 bias) nodes and 4 output nodes. Then, the algorithm will do the following steps (a little bit simplified):

ins = np.arange(4)
outs = np.arange(4) + 4
conn = np.empty((2, 16))
conn[0,:] = np.tile(ins, len(outs))
conn[1,:] = np.tile(outs,len(ins))

This will result in these connections:

array([[0., 1., 2., 3., 0., 1., 2., 3., 0., 1., 2., 3., 0., 1., 2., 3.],
       [4., 5., 6., 7., 4., 5., 6., 7., 4., 5., 6., 7., 4., 5., 6., 7.]])

The first input node is connected 4 times to the first output node, but no other. Using np.tile once and np.repeat once leads to the desired results (each input connected to each output):

array([[0., 1., 2., 3., 0., 1., 2., 3., 0., 1., 2., 3., 0., 1., 2., 3.],
       [4., 4., 4., 4., 5., 5., 5., 5., 6., 6., 6., 6., 7., 7., 7., 7.]])

Visualise WANN topologies

Hi,

This is really fascinating work that you have done here! Thank you for sharing your code.

May I know where I can find the code to visualise the WANN topologies in the same way that you have done in your paper?
image

I thought it might be in the WANNTool folder but it seems like that code is for viewing the agent in action in the environment rather than viewing the network topology.

Thanks!

Applicability to non-RL problems?

Thank you for this exciting work!!! Just wondering have you tried this methodology in non-reinfrocement settings? Would you anticipate a diffcult adaptation of this methodology?

wann_train.py error

runfile('D:/Desktop/evolution/code/WANN/wann_train.py', wdir='D:/Desktop/evolution/code/WANN')
['mpirun', '-np', '9', 'C:\Users\administered\Anaconda3\pythonw.exe', 'D:/Desktop/evolution/code/WANN/wann_train.py']
Traceback (most recent call last):

File "", line 1, in
runfile('D:/Desktop/evolution/code/WANN/wann_train.py', wdir='D:/Desktop/evolution/code/WANN')

File "C:\Users\administered\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 827, in runfile
execfile(filename, namespace)

File "C:\Users\administered\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "D:/Desktop/evolution/code/WANN/wann_train.py", line 283, in
if "parent" == mpi_fork(args.num_worker+1): os._exit(0)

File "D:/Desktop/evolution/code/WANN/wann_train.py", line 233, in mpi_fork
subprocess.check_call(["mpirun", "-np", str(n), sys.executable] +['-u']+ sys.argv, env=env)

File "C:\Users\administered\Anaconda3\lib\subprocess.py", line 306, in check_call
retcode = call(*popenargs, **kwargs)

File "C:\Users\administered\Anaconda3\lib\subprocess.py", line 287, in call
with Popen(*popenargs, **kwargs) as p:

File "C:\Users\administered\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 143, in init
super(SubprocessPopen, self).init(*args, **kwargs)

File "C:\Users\administered\Anaconda3\lib\subprocess.py", line 729, in init
restore_signals, start_new_session)

File "C:\Users\administered\Anaconda3\lib\subprocess.py", line 1017, in _execute_child
startupinfo)

FileNotFoundError: [WinError 2] The system cannot find the file specified

index XXX is out of bounds for axis 1 with size 10

Traceback (most recent call last):
File "/home/m/prettyNeatWann/wann_train.py", line 280, in
main(args)
File "/home/m/prettyNeatWann/wann_train.py", line 256, in main
slave()
File "/home/m/prettyNeatWann/wann_train.py", line 196, in slave
result = task.getFitness(wVec,aVec,hyp,seed=seed) # process it
File "/home/m/prettyNeatWann/domain/wann_task_gym.py", line 90, in getFitness
reward[iRep,iVal] = self.testInd(wMat, aVec, seed=seed+iRep,view=view)
File "/home/m/prettyNeatWann/domain/task_gym.py", line 91, in testInd
state, reward, done, info = self.env.step(action)
File "/home/m/prettyNeatWann/domain/classify_gym.py", line 67, in step
log_likelihood = -np.log(action[range(m),y])
IndexError: index 780017 is out of bounds for axis 1 with size 10

Hi,I have some problems when I run the vae_racing in prettyNEAT?

when I run the neat_train.py use the vaeRacer.json,I get this error:
Traceback (most recent call last):
File "neat_train.py", line 279, in
main(args)
File "neat_train.py", line 255, in main
slave()
File "neat_train.py", line 196, in slave
result = task.getFitness(wVec, aVec) # process it
File "/home/a/Bcw_data/rl-ga-neat-alg/Google-WANN/WANNRelease/prettyNEAT/domain/task_gym.py", line 61, in getFitness
reward[iRep] = self.testInd(wVec, aVec, view=view, seed=seed+iRep)
File "/home/a/Bcw_data/rl-ga-neat-alg/Google-WANN/WANNRelease/prettyNEAT/domain/task_gym.py", line 84, in testInd
state = self.env.reset()
File "/home/a/Bcw_data/rl-ga-neat-alg/Google-WANN/WANNRelease/prettyNEAT/domain/vae_racing.py", line 57, in reset
return super(VAERacing, self).reset()
File "/home/a/anaconda3/envs/bcw_env/lib/python3.6/site-packages/gym/envs/box2d/car_racing.py", line 311, in reset
return self.step(None)[0]
File "/home/a/Bcw_data/rl-ga-neat-alg/Google-WANN/WANNRelease/prettyNEAT/domain/vae_racing.py", line 67, in step
self.render("rgb_array")
File "/home/a/Bcw_data/rl-ga-neat-alg/Google-WANN/WANNRelease/prettyNEAT/domain/vae_racing.py", line 62, in render
return super(VAERacing, self).render(mode=mode)
File "/home/a/anaconda3/envs/bcw_env/lib/python3.6/site-packages/gym/envs/box2d/car_racing.py", line 346, in render
from gym.envs.classic_control import rendering
File "/home/a/anaconda3/envs/bcw_env/lib/python3.6/site-packages/gym/envs/classic_control/rendering.py", line 27, in
from pyglet.gl import *
File "/home/a/anaconda3/envs/bcw_env/lib/python3.6/site-packages/pyglet/gl/init.py", line 239, in
import pyglet.window
File "/home/a/anaconda3/envs/bcw_env/lib/python3.6/site-packages/pyglet/window/init.py", line 1896, in
gl._create_shadow_window()
File "/home/a/anaconda3/envs/bcw_env/lib/python3.6/site-packages/pyglet/gl/init.py", line 208, in _create_shadow_window
_shadow_window = Window(width=1, height=1, visible=False)
File "/home/a/anaconda3/envs/bcw_env/lib/python3.6/site-packages/pyglet/window/xlib/init.py", line 166, in init
super(XlibWindow, self).init(*args, **kwargs)
File "/home/a/anaconda3/envs/bcw_env/lib/python3.6/site-packages/pyglet/window/init.py", line 501, in init
display = get_platform().get_default_display()
File "/home/a/anaconda3/envs/bcw_env/lib/python3.6/site-packages/pyglet/window/init.py", line 1845, in get_default_display
return pyglet.canvas.get_display()
File "/home/a/anaconda3/envs/bcw_env/lib/python3.6/site-packages/pyglet/canvas/init.py", line 82, in get_display
return Display()
File "/home/a/anaconda3/envs/bcw_env/lib/python3.6/site-packages/pyglet/canvas/xlib.py", line 86, in init
raise NoSuchDisplayException('Cannot connect to "%s"' % name)
pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"
Can you help me to solve this problem?It looks like the problem is I use the env.render() in server?Can I close the env.render() in vaeracing?Thanks!

ListXor and alg_act parameter

What exactly is the alg_act parameter supposed to do? It's only defined on the prettyNeat code, and there it only says "activation function for hidden nodes (0 == all allowed by task)", so if it's different from 0 does it mean that the only activation function used by hidden nodes will be the value of the parameter? So should all WANNs evolved using the default params have only hyperbolic tangent as their hidden layer activation functions?
Also I believe when you call listXor you would need to cast the values to list, since for lists b + c in concatenation, but for numpy arrays it sums the two values. Is that correct or am I not understanding something?
Thank you very much for the help!

python3 neat_train.py error

[root@A01-R04-I221-48 prettyNEAT]# python3 neat_train.py
['mpirun', '-np', '9', '/usr/bin/python3', 'neat_train.py']
0 - |---| Elite Fit: 352.73 |---| Best Fit: 352.73
Traceback (most recent call last):
File "neat_train.py", line 279, in
main(args)
File "neat_train.py", line 253, in main
master()
File "neat_train.py", line 29, in master
pop = neat.ask() # Get newly evolved individuals from NEAT
File "/home/zzt/brain-tokyo-workshop/WANNRelease/prettyNEAT/neat_src/neat.py", line 51, in ask
self.evolvePop() # Create child population
File "/home/zzt/brain-tokyo-workshop/WANNRelease/prettyNEAT/neat_src/_variation.py", line 14, in evolvePop
self.innov, self.gen)
File "/home/zzt/brain-tokyo-workshop/WANNRelease/prettyNEAT/neat_src/_variation.py", line 81, in recombine
mate=pop[parents[1,i]])
File "/home/zzt/brain-tokyo-workshop/WANNRelease/prettyNEAT/neat_src/ind.py", line 98, in createChild
child = self.crossover(mate)
File "/home/zzt/brain-tokyo-workshop/WANNRelease/prettyNEAT/neat_src/ind.py", line 139, in crossover
matching, IA, IB = np.intersect1d(aConn,bConn,return_indices=True)
TypeError: intersect1d() got an unexpected keyword argument 'return_indices'

MNIST without training the weights

Is the code

"python model.py mnist256test -e 1"

performed to test WANN on MNIST without training the weights?

But I just get an accuracy of 0.0568.

Security Policy violation Binary Artifacts

This issue was automatically created by Allstar.

Security Policy Violation
Project is out of compliance with Binary Artifacts policy: binaries present in source code

Rule Description
Binary Artifacts are an increased security risk in your repository. Binary artifacts cannot be reviewed, allowing the introduction of possibly obsolete or maliciously subverted executables. For more information see the Security Scorecards Documentation for Binary Artifacts.

Remediation Steps
To remediate, remove the generated executable artifacts from the repository.

First 10 Artifacts Found

  • WANNRelease/prettyNEAT/domain/pycache/init.cpython-36.pyc
  • WANNRelease/prettyNEAT/domain/pycache/bipedal_walker.cpython-36.pyc
  • WANNRelease/prettyNEAT/domain/pycache/cartpole_swingup.cpython-36.pyc
  • WANNRelease/prettyNEAT/domain/pycache/config.cpython-36.pyc
  • WANNRelease/prettyNEAT/domain/pycache/make_env.cpython-36.pyc
  • WANNRelease/prettyNEAT/domain/pycache/picbreed.cpython-36.pyc
  • WANNRelease/prettyNEAT/domain/pycache/picbreed_gym.cpython-36.pyc
  • WANNRelease/prettyNEAT/domain/pycache/set_domain.cpython-36.pyc
  • WANNRelease/prettyNEAT/domain/pycache/task.cpython-36.pyc
  • WANNRelease/prettyNEAT/domain/pycache/task_cppn.cpython-36.pyc
  • Run a Scorecards scan to see full list.

Additional Information
This policy is drawn from Security Scorecards, which is a tool that scores a project's adherence to security best practices. You may wish to run a Scorecards scan directly on this repository for more details.


Allstar has been installed on all Google managed GitHub orgs. Policies are gradually being rolled out and enforced by the GOSST and OSPO teams. Learn more at http://go/allstar

This issue will auto resolve when the policy is in compliance.

Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

Use ==/!= to compare str, bytes, and int literals

Use ==/!= to compare str, bytes, and int literals because identity is not the same thing as equality in Python. These instances will raise a SyntaxWarning on Python >= 3.8 so it is best to fix them now. https://docs.python.org/3.8/whatsnew/3.8.html#porting-to-python-3-8

flake8 testing of https://github.com/google/brain-tokyo-workshop on Python 3.7.1

$ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics

./WANNRelease/prettyNeatWann/neat_train.py:58:6: F632 use ==/!= to compare str, bytes, and int literals
  if (gen%hyp['save_mod']) is 0:
     ^
./WANNRelease/prettyNeatWann/wann_train.py:58:6: F632 use ==/!= to compare str, bytes, and int literals
  if (gen%hyp['save_mod']) is 0:
     ^
./WANNRelease/prettyNeatWann/domain/make_env.py:62:5: F821 undefined name 'domain'
    domain.seed(seed)
    ^
./WANNRelease/prettyNeatWann/utils/utils.py:67:6: F632 use ==/!= to compare str, bytes, and int literals
  if sum(ratio) is not 1:
     ^
./WANNRelease/prettyNeatWann/utils/utils.py:96:7: F632 use ==/!= to compare str, bytes, and int literals
  if (len(A) is 0) or (len(B) is 0):
      ^
./WANNRelease/prettyNeatWann/utils/utils.py:96:24: F632 use ==/!= to compare str, bytes, and int literals
  if (len(A) is 0) or (len(B) is 0):
                       ^
./WANNRelease/prettyNeatWann/neat_src/neat_dataGatherer.py:46:8: F632 use ==/!= to compare str, bytes, and int literals
    if len(self.x_scale) is 0:
       ^
./WANNRelease/prettyNeatWann/neat_src/neat_dataGatherer.py:55:8: F632 use ==/!= to compare str, bytes, and int literals
    if len(self.best) is 0:
       ^
./WANNRelease/prettyNeatWann/neat_src/wann_ind.py:124:8: F632 use ==/!= to compare str, bytes, and int literals
    if choice is 1:
       ^
./WANNRelease/prettyNeatWann/neat_src/wann_ind.py:128:10: F632 use ==/!= to compare str, bytes, and int literals
    elif choice is 2:
         ^
./WANNRelease/prettyNeatWann/neat_src/wann_ind.py:132:10: F632 use ==/!= to compare str, bytes, and int literals
    elif choice is 3:
         ^
./WANNRelease/prettyNeatWann/neat_src/wann_ind.py:139:10: F632 use ==/!= to compare str, bytes, and int literals
    elif choice is 4:
         ^
./WANNRelease/prettyNeatWann/neat_src/wann_dataGatherer.py:42:8: F632 use ==/!= to compare str, bytes, and int literals
    if len(self.x_scale) is 0:
       ^
./WANNRelease/prettyNeatWann/neat_src/wann_dataGatherer.py:51:8: F632 use ==/!= to compare str, bytes, and int literals
    if len(self.best) is 0:
       ^
./WANNRelease/WANN/wann_train.py:57:6: F632 use ==/!= to compare str, bytes, and int literals
  if (gen%hyp['save_mod']) is 0:
     ^
./WANNRelease/WANN/wann_src/dataGatherer.py:42:8: F632 use ==/!= to compare str, bytes, and int literals
    if len(self.x_scale) is 0:
       ^
./WANNRelease/WANN/wann_src/dataGatherer.py:51:8: F632 use ==/!= to compare str, bytes, and int literals
    if len(self.best) is 0:
       ^
./WANNRelease/WANN/wann_src/_variation.py:352:6: F632 use ==/!= to compare str, bytes, and int literals
  if choice is 1:
     ^
./WANNRelease/WANN/wann_src/_variation.py:356:8: F632 use ==/!= to compare str, bytes, and int literals
  elif choice is 2:
       ^
./WANNRelease/WANN/wann_src/_variation.py:360:8: F632 use ==/!= to compare str, bytes, and int literals
  elif choice is 3:
       ^
./WANNRelease/WANN/wann_src/_variation.py:367:8: F632 use ==/!= to compare str, bytes, and int literals
  elif choice is 4:
       ^
./WANNRelease/WANN/domain/make_env.py:58:5: F821 undefined name 'domain'
    domain.seed(seed)
    ^
./WANNRelease/prettyNEAT/neat_train.py:58:6: F632 use ==/!= to compare str, bytes, and int literals
  if (gen%hyp['save_mod']) is 0:
     ^
./WANNRelease/prettyNEAT/domain/make_env.py:61:5: F821 undefined name 'domain'
    domain.seed(seed)
    ^
./WANNRelease/prettyNEAT/utils/utils.py:67:6: F632 use ==/!= to compare str, bytes, and int literals
  if sum(ratio) is not 1:
     ^
./WANNRelease/prettyNEAT/utils/utils.py:96:7: F632 use ==/!= to compare str, bytes, and int literals
  if (len(A) is 0) or (len(B) is 0):
      ^
./WANNRelease/prettyNEAT/utils/utils.py:96:24: F632 use ==/!= to compare str, bytes, and int literals
  if (len(A) is 0) or (len(B) is 0):
                       ^
./WANNRelease/prettyNEAT/neat_src/dataGatherer.py:46:8: F632 use ==/!= to compare str, bytes, and int literals
    if len(self.x_scale) is 0:
       ^
./WANNRelease/prettyNEAT/neat_src/dataGatherer.py:55:8: F632 use ==/!= to compare str, bytes, and int literals
    if len(self.best) is 0:
       ^
./WANNRelease/vae/vae.py:9:30: F821 undefined name 'sess'
  if 'sess' in globals() and sess:
                             ^
./WANNRelease/vae/vae.py:10:5: F821 undefined name 'sess'
    sess.close()
    ^
26    F632 use ==/!= to compare str, bytes, and int literals
5     F821 undefined name 'domain'
31

AttentionNeuron - Permutation invariance

Hey there,

First of all great job on the AttentionNeuron paper and code:)

I have a question related to this part of your code

if self.hx is None:
self.hx = (
torch.zeros(obs_dim, self.pos_em_dim),
torch.zeros(obs_dim, self.pos_em_dim),
)

It seems like as long as self.hx is None (which is only at the beginning of the episode) the network will be permutation invariant. However, if self.hx is not None we have already accumulated some per feature information from previous steps and the network is not going to be permutation invariant anymore (w.r.t. the observation vector). Is that correct?

Thank you very much in advance:)

any google colab implementations

i mostly work in google colab,
i have my own dataset that i want to use prettyneat(WANN) on.
for me its not so clear how i plug my data, scoring & ouput into this algoritm

Version of MNIST used to produce the results presented in the paper

Hello,

the implementation "WANN" only contains a downscaled version of the MNIST task (16x16=256 pixels), while the other two ("prettyNEAT" & "prettyNeatWann") do contain the full image task (MNIST 784 / 28x28) as well as the down-scaled version.
The illustrations in the paper (Figure 7; in the paper) and on the supplementary website suggest they were produced on the MNIST 256 task (16x16 pixels). So, I'm curious whether the presented results (Figure 6, left; in the paper) also refer to the down-scaled version or whether they were in fact produced on the full version.

Thanks a lot for sharing your work!

All the best,
Max

How to train AtariPong agent?

Hello, I just wanted to ask how to train the ataripong agent, I couldn't find any instructions on how to train for this?

Can you please guide me with this?

What is the reason for the restriction on introducing new edges (source node must be in same or lower layer)?

During topological mutation (of WANNs), edges are only added between two nodes if they are in the same layer or if the layer of the source node is in a lower layer than the destination node. In the comments of the respective functions it is stated that this is implemented this way to prevent recurrent connections.

If I am not mistaken, a non-recurrent edge should be possible as long as there is no directed path from the destination node to the source node even if the destination node is in a lower layer. This, of course, would require at least one of the nodes to switch their respective layer (which is not an issue, since the layers a recomputed during expression / translation to the network anyway).

Therefore my questions:
Why did you choose to exclude the possibility to introduce such edges? Did you just implement it this way to reduce complexity (as this would require checking for the existence of such a path and finding an alternative in case such a path exists) or is there another reason?

Theoretically, the search space stays the same, since the resulting network could be evolved from a different starting point (without requiring the introduction of these edges), but the probability to arrive at such a network might be significantly lower.

Are such networks less desirable since a change of the layer structure implies a significant change of functionality (which might be more then one is aiming for during a single mutation)?

Support for conv layers, etc?

I was wondering if the WANN algorithm would require any changes if convolutional and/or pooling layers are added, since they would impose stride/size match based issues, along with may or not working properly with a shared weight across the CNN filters

Question regarding the innovation record

Hey, I was wondering whether you actually used the data written to the innovation record at some point. In the current implementation it looks like you are just using it as a counter (and in a doc-string it is noted, that it might be used for checking whether an edge with the same node pair (src, dest) already exists. For getting a new node/edge id count from itertools could be used. For checking whether the node pair exists, a native python set might be more efficient.
Since the innovation record also stores whether a new node was generated and in which generation the innovation first occurred - it seems like you were planning to use that information somehow, but I can't reference in the code itself.
Did you use the information during debugging and analysis of executed experiments? If so, how did you utilize it?

Google Colab GPU Error

When running es_clip in the accompanying google colab instance with more than 0 GPU's, I get the following error:

Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 105, in worker
    initializer(*initargs)
  File "/content/brain-tokyo-workshop/es-clip/es_clip.py", line 97, in init_worker
    model, preprocess = clip.load('ViT-B/32', device, jit=True)  # change jit=True
  File "/usr/local/lib/python3.7/dist-packages/clip/clip.py", line 137, in load
    model = build_model(state_dict or model.state_dict()).to(device)
  File "/usr/local/lib/python3.7/dist-packages/clip/model.py", line 396, in build_model
    vit = "visual.proj" in state_dict
  File "/usr/local/lib/python3.7/dist-packages/torch/jit/_script.py", line 816, in __contains__
    return self.forward_magic_method("__contains__", key)
  File "/usr/local/lib/python3.7/dist-packages/torch/jit/_script.py", line 803, in forward_magic_method
    raise NotImplementedError()

Has anyone figured out how to solve this?

Ranking method inconsistency between duplicated projects

Hello,

In the WANN source, it seems you are ranking the individuals as described in the paper: by mean fitness + num connections (80%), or by peak fitness + num connections (20%).

In the prettyNeatWann source, however, you are sorting based only on mean fitness (80%) or by mean fitness + num connections (20%).

Is there a reason why this is different between the sources? And in general, what is the motivation of the separation between the WANN and prettyNeatWann sources? Couldn't fully understand this from the Readme description.

Thank you!

How about input and output activation functions changing?

Hello. I was really delighted by this new type of structual optimization of neural networks.
Thank you for your job, it is really awesome. 👏

Currently, I making detailed research about architectures that can be generated by using WANN algorithms within classification tasks. And at some point i've tried to change activation functions in input and output layer and I've got interesting results:

Experiments

Applied hyperparameters for all experiments:

Weights set: -2, -1, -0.5, 0.5, 1, 2
Max generations: 1024
Population size: 512
Rank by performance only \ by network complexity: 20% \ 80%
Add connection probability: 20%
Add neuron probability: 25%
Change activation function probability: 50%
Enable disabled connection probability: 5%
Keep best species in next population (elitism): 20
Destroy bad species in next population (cull): 20

XOR

Experiment 1:

Generated architecture without changing activation functions in input and output layer:

image

Mean error (for all weights): 0

Experiment 2:

Generated architecture with changing activation functions in input and output layer:

image

Mean error (for all weights): 0

Straight lines detection

image
Inputs: 3x3 square images
Outputs: 2 squares on the right side of each set.

If horizontal line only exists - output must be (1, 0).
If vertical line only exists - output must be (0, 1).
If both of it exists - output must be (1, 1).
If noone straight line exists - (0, 0).

Target: Teach neural network to detect straight (black) lines in 3x3 image.

Experiment 1:

Generated architecture without changing activation functions in input and output layer:

image

Mean error (for all weights): 0.0455

Experiment 2:

Generated architecture with changing activation functions in input and output layer:

image

Mean error (for all weights): 0.0469

Conclusions

Changing activation functions in input and output layers could reduce complexity without loss of accuracy.

It may reduce required computations.

I guess this is because connections that goes from input to hidden and from hidden to output nodes. In some tasks they really can interfer optimization, so synthesis algorithm must "destroy" them by adding additional nodes and connections.

P.S. I really hope my investigation could help for improving this awesome neural networks structural synthesis algorithm.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.