From e257d91ac1a9504a4f058c124fe315034fae2b10 Mon Sep 17 00:00:00 2001 From: sanine Date: Fri, 13 Oct 2023 12:05:34 -0500 Subject: README.md --- src/mind/README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/mind/README.md (limited to 'src/mind/README.md') diff --git a/src/mind/README.md b/src/mind/README.md new file mode 100644 index 0000000..1ece125 --- /dev/null +++ b/src/mind/README.md @@ -0,0 +1,37 @@ +mind +==== + +This module is used to create arbitrary stateful neural networks. + +The only export is the following function: + +``` +network(input_count, internal_count, output_count, weight_max = 4 : number) +``` + +This function returns an object that represents a neural network with `input_count` input neurons, +`internal_count` internal (and stateful) neurons, and `output_count` output neurons. `max_weight` determines +the maximum absolute value allowed for connection weights. + +A network object has two methods: + +``` +connect(source, sink, weight : number) +``` + +This method returns a new network object that is an exact copy of the original, except with a new +connection between the neuron indexed by `source` and `sink`, with weight `weight`. Neuron indices +are zero-indexed, and span all neurons, first the inputs, then the internal neurons, and finally the outputs. +An error will be thrown if `source` is in the range of output neurons or if `sink` is in the range of input +neurons. + + +``` +compute(inputs, state : array[number]) +``` + +This method returns a tuple `[output, newState]`, where `output` is an array of `output_count` values +corresponding to the output neuron's computed values, and `newState` is the new state of the internal neurons. + +`input` must be an array of numbers with length equal to `input_count`, and `state` must be an array of numbers +with length equal to `internal_count` or an error will be raised. -- cgit v1.2.1