Docs
NAME
createProcUnit - create object that represents a processing unit
SYNOPSIS
function createProcUnit(procUnit); function createProcUnit(procUnit, coeffUsage); function createProcUnit(procUnit, luaFunction);
DESCRIPTION
The first implementation is used to create predefined processing unit of type procUnit.
The second implementation is for radial-basis units which require coeffUsage argument to be specified. It determines the effect of so called additional coefficient on unit's output signal. If coeffUsage differs from COEFF_USAGE.NOP, then the last pair (input, weight) is excluded from the output evaluation process and their product becomes the additional coefficient.
The last implementation is for custom processing units. In this case, procUnit must be set to PROC_UNIT.CUSTOM, while luaFunction must refer to a Lua function, taking two numeric arrays of the same length and returning one numeric value. This Lua function is used to calculate a value to be passed to neuron's activation function. First array represents input signals, second one weights.
RETURN VALUES
Upon successful completion, createProcUnit returns a unique id of newly created object. Otherwise, 0 is returned.
NOTES
Try to work with predefined processing units, if possible. Using of custom units significantly slows down overall performance.
Don't forget to call closeId function to release the object when it is no longer needed.
EXAMPLES
To create unit for weighted summing:
weightedSumProcUnit = createProcUnit(PROC_UNIT.WEIGHTED_SUM);
To create radial basis processing unit with output not affected by the additional coefficient:
radialBasisProcUnit = createProcUnit(PROC_UNIT.RADIAL_BASIS, COEFF_USAGE.NOP);
To create custom processing unit:
function customProcessing(x, w) local net = 0.0; local i; for i = 1, #x do net = net + (x[i] + w[i]); end; return net; end; customProcUnit = createProcUnit(PROC_UNIT.CUSTOM, customProcessing);
SEE ALSO
PROC_UNIT, COEFF_USAGE, createAbstractNeuron, createDigitalNeuron, closeId