aboutsummaryrefslogtreecommitdiff
path: root/demo
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2007-10-02 14:22:29 +0000
committerArmin Rigo <arigo@tunes.org>2007-10-02 14:22:29 +0000
commit258183f65705e86c5c613904ac3602d1c34005b5 (patch)
tree0163e29cdf12a554097ade93907fc14f39c25826 /demo
parentImprove comments. (diff)
downloadpypy-258183f65705e86c5c613904ac3602d1c34005b5.tar.gz
pypy-258183f65705e86c5c613904ac3602d1c34005b5.tar.bz2
pypy-258183f65705e86c5c613904ac3602d1c34005b5.zip
Avoid float **.
Diffstat (limited to 'demo')
-rwxr-xr-xdemo/bpnn.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/demo/bpnn.py b/demo/bpnn.py
index 2b5420af34..3620c58eb6 100755
--- a/demo/bpnn.py
+++ b/demo/bpnn.py
@@ -131,7 +131,8 @@ class NN:
# calculate error
error = 0.0
for k in range(len(targets)):
- error = error + 0.5*(targets[k]-self.ao[k])**2
+ delta = targets[k]-self.ao[k]
+ error = error + 0.5*delta*delta
return error