ignore_zero_vector on the spatial nodes does the "blink": emits zero on inference given a zero vector. turn this off for temporalsequence. for temporalsequence put reset_on_zero_vector to true to reset the history and return on a zero vector. if you tell temporal sequence to ignore zero vector, then it never sees the zero vector (the return is in the Node.py not in the IncrementalSequence.py). I have to check the .pyx files for any problems with this.
authorBrian Blais <bblais@bryant.edu>
Fri Aug 01 15:49:53 2008 -0400 (3 months ago)
changeset 40389c18f81791
parent 39c099a719b47a
child 412d7823a18da9
ignore_zero_vector on the spatial nodes does the "blink": emits zero on inference given a zero vector. turn this off for temporalsequence. for temporalsequence put reset_on_zero_vector to true to reset the history and return on a zero vector. if you tell temporal sequence to ignore zero vector, then it never sees the zero vector (the return is in the Node.py not in the IncrementalSequence.py). I have to check the .pyx files for any problems with this.
--- a/ghost/nodes2/IncrementalSequence.py Tue Jul 08 11:37:36 2008 -0400
+++ b/ghost/nodes2/IncrementalSequence.py Fri Aug 01 15:49:53 2008 -0400
@@ -25,6 +25,7 @@ class IncrementalSequence(Node):
self.max_clusters=max_clusters
self.steps_without_adding=steps_without_adding
self.steps_count=0
+ self.reset_on_zero_vector=False
def get_observation(self,input_vector):
# distribution fed as input vector
@@ -36,6 +37,11 @@ class IncrementalSequence(Node):
def update_feedforward(self,input_vector):
self.first_inference=True
self.steps_count+=1
+
+ if self.reset_on_zero_vector and not any(input_vector):
+ self.h=[]
+ self.steps_count=0
+ return
# distribution fed as input vector
observation=self.get_observation(input_vector)
--- a/ghost/nodes2/LeaderFollower.py Tue Jul 08 11:37:36 2008 -0400
+++ b/ghost/nodes2/LeaderFollower.py Fri Aug 01 15:49:53 2008 -0400
@@ -26,7 +26,8 @@ except ImportError:
class LeaderFollower(Node):
- def __init__(self,sigma=0.25,eta=0.1,use_prune=False,max_clusters=1e500,steps_without_adding=1e500):
+ def __init__(self,sigma=0.25,eta=0.1,use_prune=False,
+ max_clusters=1e500,steps_without_adding=1e500):
super(LeaderFollower,self).__init__()
@@ -40,6 +41,7 @@ class LeaderFollower(Node):
def update_feedforward(self,input_vector):
# update_feedforward will not be called if self.learning is false
+
min_clust,min_dist=get_winner(input_vector,
self.clusters,
--- a/ghost/nodes2/Node.py Tue Jul 08 11:37:36 2008 -0400
+++ b/ghost/nodes2/Node.py Fri Aug 01 15:49:53 2008 -0400
@@ -124,6 +124,7 @@ class Node(object):
self.last_inference=None
self.logfile=sys.stdout
+
def add_children(self,C):
if not isinstance(C,list): # layers and metanodes are indexible
C=[C]
@@ -142,10 +143,11 @@ class Node(object):
parent.children.append(self)
def update(self,input_vector):
+
if self.learning:
if not self.input_index is None:
input_vector=input_vector[self.input_index]
-
+
if self.ignore_zero_cluster and not any(input_vector):
return