Skip to content

Instantly share code, notes, and snippets.

View stefanopalmieri's full-sized avatar

Stefano Palmieri stefanopalmieri

View GitHub Profile
import numpy as np
import gym
from gym import wrappers
env = gym.make('CartPole-v1')
env = wrappers.Monitor(env, '/tmp/cartpole-experiment-v1', force=True)
for i_episode in range(100):
observation = env.reset()
while True:
@stefanopalmieri
stefanopalmieri / experiment.py
Last active January 8, 2017 17:49
Terminal output for NEAT using CAMPN on Cartpole-V0
import numpy as np
import math
from population import Population
from cartographer import Cartographer
import gym
from gym import wrappers
# NEAT experiment using the CAMPN encoding
# In this experiment node types used are Input, Output, Hadamard and Kronecker
# A neural network is trained using NEAT
# The idea is from the paper: "Evolving Neural Networks through Augmenting Topologies"
# This gist is using MultiNEAT (http://multineat.com/)
import logging
import numpy as np
import pickle
import gym
# A neural network is trained using ES-HyperNEAT
# The idea is from the paper: "Evolving Neural Networks through Augmenting Topologies"
# This gist is using MultiNEAT (http://multineat.com/)
import logging
import numpy as np
import pickle
import gym
# A neural network is trained using ES-HyperNEAT
# The idea is from the paper: "Evolving Neural Networks through Augmenting Topologies"
# This gist is using MultiNEAT (http://multineat.com/)
import logging
import numpy as np
import pickle
import gym
# Using ES-HyperNEAT to try to solve the Bipedal walker.
# This attempt was not successful. Adjustment of hyperparameters is likely needed.
# A neural network is trained using NeuroEvolution of Augmenting Topologies
# The idea is from the paper: "Evolving Neural Networks through Augmenting Topologies"
# This gist is using MultiNEAT (http://multineat.com/)
import logging
import numpy as np
import pickle
# Solution organism was found in 78th generation
# Total of 200 * 5 * 78 = 78000 trials were used for training
from __future__ import print_function
import gym
import numpy as np
import itertools
import os
@stefanopalmieri
stefanopalmieri / xor2.config
Created October 10, 2016 22:56
Walker Experiment Gist code
#--- parameters for the pole experiment v1 ---#
# The `Types` section specifies which classes should be used for various
# tasks in the NEAT algorithm. If you use a non-default class here, you
# must register it with your Config instance before loading the config file.
[Types]
stagnation_type = DefaultStagnation
reproduction_type = DefaultReproduction
[phenotype]
#--- parameters for the pole experiment v1 ---#
# Two trials were held for each organism and the average fitness was taken.
# The `Types` section specifies which classes should be used for various
# tasks in the NEAT algorithm. If you use a non-default class here, you
# must register it with your Config instance before loading the config file.
[Types]
stagnation_type = DefaultStagnation
reproduction_type = DefaultReproduction
#--- parameters for the pole experiment ---#
# The `Types` section specifies which classes should be used for various
# tasks in the NEAT algorithm. If you use a non-default class here, you
# must register it with your Config instance before loading the config file.
[Types]
stagnation_type = DefaultStagnation
reproduction_type = DefaultReproduction
[phenotype]