Creature Class
The Creature class represents an AI entity within the NEAT (NeuroEvolution of Augmenting Topologies) framework. It encapsulates the neural network structure and its associated behaviors, including activation, mutation, propagation, and evolution processes. This class is integral to the simulation and evolution of neural networks.
cacheFocus: Map<number, boolean>
creatureActivationFunction: () => undefined
memetic: MemeticInterface
Records the origins of this creature.
neurons: Neuron[]
The array of neurons within this creature.
state: CreatureState
The state of the creature, managing the internal state and activations.
synapses: Synapse[]
The array of synapses (connections) between neurons.
tags: TagInterface[]
Optional tags associated with the creature.
activate(input: Float32Array,feedbackLoop?: boolean,): Float32Array
Activates the creature without calculating traces.
Activates the creature and traces the activity.
applyLearnings(config: BackPropagationConfig,sparseConfig: SparseConfig,): boolean
Apply learnings to the creature using back propagation.
binarySearchForStartIndex(fromIndx: number): number
bulkLoadInwardConnections(toIndx: number): Synapse[]
Precompiles all inward connections and caches them for fast lookup.
clearCache(): void
Clear the cache of connections.
clearState(): void
Clear the context of the creature.
connect(): Synapse
Connect two neurons with a synapse.
disconnect(): void
Disconnect two neurons by removing the synapse between them.
dispose(): void
Dispose of the creature and all held memory.
evaluateDir(): { error: number; }
Evaluate a dataset and return the error.
evolveDataSet(dataSet: DataRecordInterface[],options: NeatOptions,): Promise<{ error: number; score: number; time: number; }>
Evolve the creature to achieve a lower error on a dataset.
evolveDir(dataSetDir: string,options: NeatOptions,): Promise<{ error: number; score: number; time: number; generation: number; }>
Evolve the creature to achieve a lower error on a dataset.
Convert the creature to a JSON object.
fix(): void
Fix the structure of the creature.
getSynapse(): Synapse | null
Get a specific synapse between two neurons.
Check if a neuron is in focus.
initialize(options: { layers?: { squash?: string; count: number; }[]; }): void
internalJSON(): CreatureInternal
Convert the creature to an internal JSON object.
inwardConnections(toIndx: number): Synapse[]
Get the inward connections (afferent) for the neuron at the given index.
loadFrom(json: CreatureInternal | CreatureExport,validate: boolean,): void
Load the creature from a JSON object.
makeRandomConnection(indx: number): Synapse | null
Create a random connection for the neuron at the given index.
Mutate the creature using a specific method.
Get the output count of the creature.
outwardConnections(fromIndx: number): Synapse[]
Get the outward connections (efferent) for the neuron at the given index.
prepareNeurons(): void
propagate(): void
Propagate the expected values through the creature's network.
propagateUpdate(config: BackPropagationConfig,sparseConfig: SparseConfig,): void
Update the propagated values in the creature's network.
record(expected: Float32Array): Map<string, DiscoverRecord>
Record the expected values for back propagation.
selfConnection(indx: number): SynapseInternal | null
Get a self-connection for the neuron at the given index.
Convert the creature to a trace JSON object.
validate(): void
Validate the creature structure.
writeCreatures(neat: Neat,dir: string,): void
fromJSON(json: CreatureInternal | CreatureExport,validate?: boolean,): Creature
Convert a json object to a creature