+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-<head><title>Dennco - test1</title>
-<link rel="stylesheet" type="text/css" href="dstyle.css" />
-</head>
-
-<body>
-
-<a define="cell" name="cell1">
-<a parameter="cellcode" href="#PerceptronCellCode"> </a>
-<a parameter="connection" href="../3/3_a.xhtml#cell1output" receptor="output"></a>
-</a>
-
-<a define="cellcode" name="PerceptronCellCode" type="B">
-<pre parameter="script">
-<![CDATA[
-
-var threshold = 0.5;
-
-var wights = new Array();
-var correctedWights = new Array();
-var u0wight = 0;
-var correctedU0wight = 0;
-var units = new Array();
-var learned = false;
-
-function doInit()
-{
- for (var r in this.cell.receptors)
- {
- if (r.match(/^u[0-9][0-9]$/)
- {
- var index = Number(r.substring(1));
- this.units[index] = r;
- this.wights[index] = 0;
- this.correctedWights[index] = 0;
- }
- }
-}
-
-function doTick(time)
-{
- //process for output
- var sum = 1 * u0wight;
- for (var index in units)
- {
- sum += this.cell.receptors[units[index]] * wights[index];
- }
- var output = sum < this.threshold ? 0 : 1;
- this.cell.axonValue = output;
-
- //process for learn
- var learn = this.cell.receptors.learn;
- var exp = this.cell.receptors.expected;
- var rate = this.cell.receptors.learningRate;
-
- if (learn == 1)
- {
- if (!this.learned)
- {
- if (exp != output)
- {
- var correctionRate = rate * (exp - output);
- correctedU0wight = u0wight + u0wight * correctionRate;
- for (var index in units)
- {
- correctedWights[index] = wights[index] + (wights[index] * correctionRate);
- }
- }
- this.learned = true;
- }
- }
- else
- {
- if (this.learned)
- {
-
-
- }
- this.learned = false;
- }
-}
-]]>
-</pre>
-</a>
-
-</body>
-</html>
\ No newline at end of file