Node - kwsaxman/NeuralNetworks GitHub Wiki

Nodes connect different edges in a [Neural Network]]. Nodes have [NodeType and NodeValue, which are Enums. Nodes also hold their index, and which nodes are connected to them in an int array.

NodeType

NodeType is an enum with values START, MIDDLE, END. NodeType.START designates that the original input should be executed starting here. NodeType.MIDDLE and NodeType.END only take input from previous Nodes. NodeType.END will also produce the output.

NodeValue

NodeValue is an enum with values POSITIVE or NEGATIVE. NodeValue.POSITIVE designates that values passed to the execute function will be added or ANDed together. NodeValue.NEGATIVE designates the node will negate the sum of multiple inputs aka NAND.

int execute(int[] input)

if Node is positive, it will sum all values
if Node is negative, it will negate the sum of all values

int execute(int input)

if Node is positive, it will return the value
if Node is negative, it will negate the value