en ru

Docs

NAME

setAbstractWeights - set the abstract weights values

SYNOPSIS

function setAbstractWeights(neuronId, values);
function setAbstractWeights(weightsId, baseIndex, values);

DESCRIPTION

The first implementation is used to set the weights values to the abstract neuron with id neuronId.

The second implementation is used to set the values to the abstract weights with id weightsId. The values will be assigned one by one to the weights, starting from baseIndex weight.

RETURN VALUES

None.

EXAMPLES

To set the weights values to the abstract neuron:

connectors = createAbstractConnectors(3);
weights = createAbstractWeights(2);
procUnit = createProcUnit(PROC_UNIT.WEIGHTED_SUM);
actFunc = createActFunc(ACT_FUNC.LINEAR, 1.0, 0.0);

-- Create neuron with external weights;
neuron1 = createAbstractNeuron(2, {0, 1}, connectors, 2, weights, 0, procUnit, actFunc);
setAbstractWeights(neuron1, {1.0, 5.5});
values = getAbstractWeights(neuron1); -- {1.0, 5.5}
setAbstractWeights(weights, 1, {6.0});
values = getAbstractWeights(neuron1); -- {1.0, 6.0}

-- Create neuron with built-in weights;
neuron2 = createAbstractNeuron(2, {0, 1}, connectors, 2, 0, 0, procUnit, actFunc);
setAbstractWeights(neuron2, {7.0, 3.0});
values = getAbstractWeights(neuron2); -- {7.0, 3.0}

To set the values to the abstract weights:

weights = createAbstractWeights(5);

setAbstractWeights(weights, 0, {0.0, 2.0, 5.5, 1.0, 7.0});
values = getAbstractWeights(weights, 0, 5); -- {0.0, 2.0, 5.5, 1.0, 7.0}

setAbstractWeights(weights, 1, {8.0, 7.5, 3.0});
values = getAbstractWeights(weights, 0, 5); -- {0.0, 8.0, 7.5, 3.0, 7.0}

setAbstractWeights(weights, 4, {9.0});
values = getAbstractWeights(weights, 0, 5); -- {0.0, 8.0, 7.5, 3.0, 9.0}

SEE ALSO

createAbstractWeights, getAbstractWeights

Verbatim copying and distribution of this entire article are permitted in any medium, provided this notice is preserved.
Send suggestions, questions and bug reports to neurowombatmail@gmail.com
Copyright © 2009, 2010, 2011, 2012 Andrew Timashov