Phase 3
The third and last phase actually carries out learning. In this phase segment updates that have been queued up are actually implemented once we get feed- forward input and the cell is chosen as a learning cell (lines 56-57). Otherwise, if the cell ever stops predicting for any reason, we negatively reinforce the segments (lines 58-60).
54. for c, i in cells 55. if learnState(s, i, t) == 1 then 56. adaptSegments (segmentUpdateList(c, i), true) 57. segmentUpdateList(c, i).delete() 58. else if predictiveState(c, i, t) == 0 and predictiveState(c, i, t-1)==1 then 59. adaptSegments (segmentUpdateList(c,i), false) 60. segmentUpdateList(c, i).delete() 61.
|