Configuration¶
Contains the classes and functions related to abrain’s configuration
- class abrain.Config[source]¶
Wrapper for the C++ configuration data
Allows transparent access to the values used for CPPN structure, genome mutation (
Genome.mutate()), and ANN/ES-HyperNEAT parameters- classmethod from_json(j: Dict)[source]¶
Restore values from a json-compliant Python dictionary
- Parameters:
j – the dictionary to parse values from
- classmethod read(path: Path)[source]¶
Try to load data from provided path
- Parameters:
path – Filename
- classmethod write(path: Path | None)[source]¶
Write the configuration to the specified file or stdout
- Parameters:
path – where to write or none to print to screen
- Bias = <ESHNOutputs.Bias: 2>¶
- LEO = <ESHNOutputs.LEO: 1>¶
- Weight = <ESHNOutputs.Weight: 0>¶
- activationFunc = 'ssgn'¶
The activation function used by all hidden/output neurons (inputs are passthrough)
- allowPerceptrons = True¶
Attempt to generate a perceptron if no hidden neurons were discovered
- annWeightsRange = 3.0¶
Scaling factor s for the CPPN w output mapping \([-1,1] to [-s,s]\)
- bndThr = 0.15000000596046448¶
Minimal divergence threshold for discovering neurons
- cppnWeightBounds = Bounds(-3, -1, 1, 3, 0.01)¶
Initial and maximal bounds for each of the CPPN’s weights
- defaultOutputFunction = 'id'¶
Output function for random generic CPPNs
- divThr = 0.30000001192092896¶
Division threshold for a quad-/octtree cell/cube
- eshnOutputFunctions = OutputFunctions{0: bsgm, 1: step, 2: id}¶
- functionSet = Strings[abs, gaus, id, bsgm, sin, step]¶
List of functions accessible to nodes via creation/mutation
- initialDepth = 2¶
Initial division depth for the underlying quad-/octtree
- iterations = 10¶
Maximal number of discovery steps for Hidden/Hidden connections. Can stop early in case of convergence (no new neurons discovered)
- maxDepth = 3¶
Maximal division depth for the underlying quad-/octtree
- mutationRates = MutationRates{add_l: 0.0681818, add_n: 0.0454545, del_l: 0.0909091, del_n: 0.0681818, mut_f: 0.227273, mut_w: 0.5}¶
Probabilities for each point mutation (addition/deletion/alteration)
- Glossary:
add_l: add a random link between two nodes (feedforward only)
add_n: replace a link by creating a node
del_l: delete a random link (never leaves unconnected nodes)
del_n: replace a simple node by a direct link
mut_f: change the function of a node
mut_w: change the connection weight of a link
- varThr = 0.30000001192092896¶
Variance threshold for exploring a quad-/octtree cell/cube
- class abrain.Config.ESHNOutputs¶
Members:
Weight
LEO
Bias
- Bias = <ESHNOutputs.Bias: 2>¶
- LEO = <ESHNOutputs.LEO: 1>¶
- Weight = <ESHNOutputs.Weight: 0>¶
- name¶
Name of the output
- value¶
Corresponding value of the output
- class Config.MutationRates(values: dict[str, float])¶
A map from strings to floats (interfacing with the C++ layer)
- class Config.OutputFunctions(values: dict[str, str])¶
A map from strings to function names (strings, interfacing with the C++ layer)
- class Config.FBounds(min: float, rndMin: float, rndMax: float, max: float, stddev: float)¶
A wrapper for mutation bounds. Absolute range is [min, max]. Values produced through random initialization are further restricted to [rndMin, rndMax] with
\[min \leq rndMin \leq rndMax \leq max\]stddev is the standard deviation for every point-mutation applied to the corresponding field.