Current Progress: After final design presentation
This commit is contained in:
@@ -1 +0,0 @@
|
||||
from .config import Configer
|
||||
@@ -1,51 +0,0 @@
|
||||
import os
|
||||
import warnings
|
||||
import configparser
|
||||
|
||||
|
||||
class Configer:
|
||||
@classmethod
|
||||
def __load_default_config(cls):
|
||||
par_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
default_config_path = os.path.join(par_dir, "default_config.ini")
|
||||
return cls.__load_config(default_config_path)
|
||||
|
||||
@classmethod
|
||||
def __load_config(cls, config_path):
|
||||
c = configparser.ConfigParser()
|
||||
c.read(config_path)
|
||||
config = {}
|
||||
|
||||
for section in c.sections():
|
||||
for key, value in c.items(section):
|
||||
config[key] = eval(value)
|
||||
|
||||
return config
|
||||
|
||||
@classmethod
|
||||
def __check_redundant_config(cls, default_config, config):
|
||||
for key in config:
|
||||
if key not in default_config:
|
||||
warnings.warn(f"Redundant config: {key} in {config.name}")
|
||||
|
||||
@classmethod
|
||||
def __complete_config(cls, default_config, config):
|
||||
for key in default_config:
|
||||
if key not in config:
|
||||
config[key] = default_config[key]
|
||||
|
||||
@classmethod
|
||||
def load_config(cls, config_path=None):
|
||||
default_config = cls.__load_default_config()
|
||||
if config_path is None:
|
||||
config = {}
|
||||
elif not os.path.exists(config_path):
|
||||
warnings.warn(f"config file {config_path} not exist!")
|
||||
config = {}
|
||||
else:
|
||||
config = cls.__load_config(config_path)
|
||||
|
||||
cls.__check_redundant_config(default_config, config)
|
||||
cls.__complete_config(default_config, config)
|
||||
# cls.__decorate_config(config)
|
||||
return config
|
||||
@@ -1,65 +0,0 @@
|
||||
[basic]
|
||||
num_inputs = 2
|
||||
num_outputs = 1
|
||||
init_maximum_nodes = 20
|
||||
init_maximum_connections = 20
|
||||
init_maximum_species = 10
|
||||
expands_coe = 2
|
||||
forward_way = "pop_batch"
|
||||
|
||||
[population]
|
||||
fitness_threshold = 100000
|
||||
generation_limit = 100
|
||||
fitness_criterion = "max"
|
||||
pop_size = 150
|
||||
|
||||
[genome]
|
||||
compatibility_disjoint = 1.0
|
||||
compatibility_weight = 0.5
|
||||
conn_add_prob = 0.5
|
||||
conn_add_trials = 1
|
||||
conn_delete_prob = 0
|
||||
node_add_prob = 0.2
|
||||
node_delete_prob = 0
|
||||
|
||||
[species]
|
||||
compatibility_threshold = 3.0
|
||||
species_elitism = 2
|
||||
species_max_stagnation = 15
|
||||
genome_elitism = 2
|
||||
survival_threshold = 0.2
|
||||
min_species_size = 1
|
||||
|
||||
[gene-bias]
|
||||
bias_init_mean = 0.0
|
||||
bias_init_stdev = 1.0
|
||||
bias_mutate_power = 0.5
|
||||
bias_mutate_rate = 0.7
|
||||
bias_replace_rate = 0.1
|
||||
|
||||
[gene-response]
|
||||
response_init_mean = 1.0
|
||||
response_init_stdev = 0.0
|
||||
response_mutate_power = 0.0
|
||||
response_mutate_rate = 0.0
|
||||
response_replace_rate = 0.0
|
||||
|
||||
[gene-activation]
|
||||
activation_default = "sigmoid"
|
||||
activation_options = ["sigmoid"]
|
||||
activation_replace_rate = 0.0
|
||||
|
||||
[gene-aggregation]
|
||||
aggregation_default = "sum"
|
||||
aggregation_options = ["sum"]
|
||||
aggregation_replace_rate = 0.0
|
||||
|
||||
[gene-weight]
|
||||
weight_init_mean = 0.0
|
||||
weight_init_stdev = 1.0
|
||||
weight_mutate_power = 0.5
|
||||
weight_mutate_rate = 0.8
|
||||
weight_replace_rate = 0.1
|
||||
|
||||
[gene-enable]
|
||||
enable_mutate_rate = 0.01
|
||||
Reference in New Issue
Block a user