Esempio n. 1
0
func (pm *PermanenceMap) weaken(input data.Bitset) {
	for k, v := range pm.permanence {
		if input.IsSet(k) {
			v -= pm.config.Decrement
		}
		pm.Set(k, v)
	}
}
Esempio n. 2
0
func (pm *PermanenceMap) narrow(input data.Bitset) {
	for k, v := range pm.permanence {
		if input.IsSet(k) {
			v += pm.config.Increment
		} else {
			v -= pm.config.Decrement
		}
		pm.Set(k, v)
	}
}
Esempio n. 3
0
func (c *Column) ConfirmPrediction(state data.Bitset) bool {
	if c.learning >= 0 && state.IsSet(c.CellId(c.learning)) {
		if log.HtmLogger.Enabled() {
			log.HtmLogger.Printf("\t(%d, %d)=%04d: Confirmed prediction.",
				c.Index, c.learning, c.CellId(c.learning))
		}
		return true
	}
	return false
}
Esempio n. 4
0
func (s *PeriodicSensor) Decode(bits data.Bitset) interface{} {
	found := bits.Any(func(int) bool {
		return true
	})
	if bits.IsSet(found + 2) {
		return found + 1 + s.First
	} else if bits.IsSet(found + 1) {
		// found is the center bit, so first.
		return s.First
	} else {
		// found is center bit + 1, so last.
		return s.Last
	}
}