delete useless;

append readme
This commit is contained in:
wls2002
2023-09-15 23:50:10 +08:00
parent 4efa9445d5
commit f217d87ac6
7 changed files with 137 additions and 123 deletions

View File

@@ -5,6 +5,7 @@ from algorithm.neat.gene import NormalGene, NormalGeneConfig
from problem.func_fit import XOR, FuncFitConfig
if __name__ == '__main__':
# running config
config = Config(
basic=BasicConfig(
seed=42,
@@ -12,13 +13,6 @@ if __name__ == '__main__':
pop_size=10000
),
neat=NeatConfig(
max_nodes=50,
max_conns=100,
max_species=30,
conn_add=0.8,
conn_delete=0,
node_add=0.4,
node_delete=0,
inputs=2,
outputs=1
),
@@ -27,10 +21,13 @@ if __name__ == '__main__':
error_method='rmse'
)
)
# define algorithm: NEAT with NormalGene
algorithm = NEAT(config, NormalGene)
# full pipeline
pipeline = Pipeline(config, algorithm, XOR)
# initialize state
state = pipeline.setup()
pipeline.pre_compile(state)
# run until terminate
state, best = pipeline.auto_run(state)
# show result
pipeline.show(state, best)

41
examples/general_xor.py Normal file
View File

@@ -0,0 +1,41 @@
from config import *
from pipeline import Pipeline
from algorithm import NEAT
from algorithm.neat.gene import NormalGene, NormalGeneConfig
from problem.func_fit import XOR, FuncFitConfig
def evaluate():
pass
if __name__ == '__main__':
config = Config(
basic=BasicConfig(
seed=42,
fitness_target=-1e-2,
pop_size=10000
),
neat=NeatConfig(
max_nodes=50,
max_conns=100,
max_species=30,
conn_add=0.8,
conn_delete=0,
node_add=0.4,
node_delete=0,
inputs=2,
outputs=1
),
gene=NormalGeneConfig(),
problem=FuncFitConfig(
error_method='rmse'
)
)
algorithm = NEAT(config, NormalGene)
pipeline = Pipeline(config, algorithm, XOR)
state = pipeline.setup()
pipeline.pre_compile(state)
state, best = pipeline.auto_run(state)
pipeline.show(state, best)