complete fully stateful!
use black to format all files!
This commit is contained in:
@@ -4,7 +4,7 @@ from algorithm.neat import *
|
||||
from problem.func_fit import XOR3d
|
||||
from utils import Act
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
pipeline = Pipeline(
|
||||
algorithm=NEAT(
|
||||
species=DefaultSpecies(
|
||||
@@ -18,22 +18,22 @@ if __name__ == '__main__':
|
||||
activation_options=(Act.tanh,),
|
||||
),
|
||||
output_transform=Act.sigmoid, # the activation function for output node
|
||||
mutation=DefaultMutation(
|
||||
node_add=0.05,
|
||||
conn_add=0.2,
|
||||
node_delete=0,
|
||||
conn_delete=0,
|
||||
),
|
||||
),
|
||||
pop_size=10000,
|
||||
species_size=10,
|
||||
compatibility_threshold=3.5,
|
||||
survival_threshold=0.01, # magic
|
||||
),
|
||||
mutation=DefaultMutation(
|
||||
node_add=0.05,
|
||||
conn_add=0.2,
|
||||
node_delete=0,
|
||||
conn_delete=0,
|
||||
)
|
||||
),
|
||||
problem=XOR3d(),
|
||||
generation_limit=10000,
|
||||
fitness_target=-1e-8
|
||||
fitness_target=-1e-8,
|
||||
)
|
||||
|
||||
# initialize state
|
||||
|
||||
@@ -5,17 +5,28 @@ from utils import Act
|
||||
|
||||
from problem.func_fit import XOR3d
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
pipeline = Pipeline(
|
||||
algorithm=HyperNEAT(
|
||||
substrate=FullSubstrate(
|
||||
input_coors=[(-1, -1), (0.333, -1), (-0.333, -1), (1, -1)],
|
||||
hidden_coors=[
|
||||
(-1, -0.5), (0.333, -0.5), (-0.333, -0.5), (1, -0.5),
|
||||
(-1, 0), (0.333, 0), (-0.333, 0), (1, 0),
|
||||
(-1, 0.5), (0.333, 0.5), (-0.333, 0.5), (1, 0.5),
|
||||
(-1, -0.5),
|
||||
(0.333, -0.5),
|
||||
(-0.333, -0.5),
|
||||
(1, -0.5),
|
||||
(-1, 0),
|
||||
(0.333, 0),
|
||||
(-0.333, 0),
|
||||
(1, 0),
|
||||
(-1, 0.5),
|
||||
(0.333, 0.5),
|
||||
(-0.333, 0.5),
|
||||
(1, 0.5),
|
||||
],
|
||||
output_coors=[
|
||||
(0, 1),
|
||||
],
|
||||
output_coors=[(0, 1), ],
|
||||
),
|
||||
neat=NEAT(
|
||||
species=DefaultSpecies(
|
||||
@@ -42,7 +53,7 @@ if __name__ == '__main__':
|
||||
),
|
||||
problem=XOR3d(),
|
||||
generation_limit=300,
|
||||
fitness_target=-1e-6
|
||||
fitness_target=-1e-6,
|
||||
)
|
||||
|
||||
# initialize state
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from pipeline import Pipeline
|
||||
from algorithm.neat import *
|
||||
from algorithm.neat.gene.node.default_without_response import NodeGeneWithoutResponse
|
||||
|
||||
from problem.func_fit import XOR3d
|
||||
from utils.activation import ACT_ALL, Act
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
pipeline = Pipeline(
|
||||
seed=0,
|
||||
algorithm=NEAT(
|
||||
@@ -15,27 +16,26 @@ if __name__ == '__main__':
|
||||
max_nodes=50,
|
||||
max_conns=100,
|
||||
activate_time=5,
|
||||
node_gene=DefaultNodeGene(
|
||||
activation_options=ACT_ALL,
|
||||
activation_replace_rate=0.2
|
||||
node_gene=NodeGeneWithoutResponse(
|
||||
activation_options=ACT_ALL, activation_replace_rate=0.2
|
||||
),
|
||||
output_transform=Act.sigmoid,
|
||||
mutation=DefaultMutation(
|
||||
node_add=0.05,
|
||||
conn_add=0.2,
|
||||
node_delete=0,
|
||||
conn_delete=0,
|
||||
),
|
||||
output_transform=Act.sigmoid
|
||||
),
|
||||
pop_size=10000,
|
||||
species_size=10,
|
||||
compatibility_threshold=3.5,
|
||||
survival_threshold=0.03,
|
||||
),
|
||||
mutation=DefaultMutation(
|
||||
node_add=0.05,
|
||||
conn_add=0.2,
|
||||
node_delete=0,
|
||||
conn_delete=0,
|
||||
)
|
||||
),
|
||||
problem=XOR3d(),
|
||||
generation_limit=10000,
|
||||
fitness_target=-1e-8
|
||||
fitness_target=-1e-8,
|
||||
)
|
||||
|
||||
# initialize state
|
||||
|
||||
Reference in New Issue
Block a user