summaryrefslogtreecommitdiff
path: root/src/mind
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-10-13 12:05:34 -0500
committersanine <sanine.not@pm.me>2023-10-13 12:05:34 -0500
commite257d91ac1a9504a4f058c124fe315034fae2b10 (patch)
treebfa28b244225f763cd0924cfa582bb7466642b29 /src/mind
parent1ad77cbdadb6e8c389c128b0f95907505e1b22ca (diff)
README.md
Diffstat (limited to 'src/mind')
-rw-r--r--src/mind/README.md37
1 files changed, 37 insertions, 0 deletions
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.