lame (#2341)(an instance of Root Class made by flat)Go to location of this object, flat. VERB SOURCE CODE: make-net:
params = $string_utils:explode(argstr);
layers = {};
depth = length(params);
for ln in [1..depth]
layer = {};
links = {};
if (ln != 1)
for node in [1..tonum(params[ln - 1])]
links = {@links, 100};
endfor
endif
for node in [1..tonum(params[ln])]
if (links)
layer = {@layer, {1, links}};
else
layer = {@layer, 1};
endif
endfor
layers = {@layers, layer};
endfor
if (length(layers) == length(params))
player:tell("A ", length(params), "-layered job well done.");
this.nodes = layers;
endif
.
_input:
inputs = args[1];
if (length(this.nodes[1]) == length(inputs))
this.nodes[1] = inputs;
endif
.
_sum:
layer = tonum(args[1]);
for node in [1..length(this.nodes[layer])]
value = 100;
linklist = this.nodes[layer][node][2];
for link in [1..length(linklist)]
if (layer == 2)
value = value + (linklist[link] * this.nodes[layer - 1][link]);
else
value = value + (linklist[link] * this.nodes[layer - 1][link][1]);
endif
endfor
this.nodes[layer][node][1] = ((value / length(linklist)) > 50) ? 1 | 0;
endfor
.
_train:
input = args[1];
desiredout = args[2];
this:input(input);
for layer in [2..length(this.nodes)]
this:sum(layer);
endfor
actualout = {};
for node in (this.nodes[length(this.nodes)])
actualout = {@actualout, node[1]};
endfor
this:_backprop(desiredout, actualout, length(this.nodes));
.
_backprop: desiredout = args[1]; actualout = args[2]; layer = args[3]; . sum:
layer = tonum(argstr);
this:_sum(layer);
out = "Neuron outputs: ";
for node in (this.nodes[length(this.nodes)])
out = tostr(out, node[1], " ");
endfor
inputout = "Neuron inputs: ";
for node in (this.nodes[1])
inputout = tostr(inputout, node, " ");
endfor
player:tell_lines({inputout, out});
.
input:
ins = $string_utils:explode(argstr);
out = {};
for i in (ins)
out = {@out, tonum(i)};
endfor
this:_input(out);
player:tell(argstr);
.
PROPERTY DATA:       nodes       feature_ok |