Beispiel #1
0
func (d *Drop) InitializeNetwork() {
	params := htm.RegionParameters{
		Name:                "0-drop",
		Width:               640,
		Height:              8,
		MinimumInputOverlap: 1,
		InputLength:         64,
		Learning:            true,
	}
	params.MaximumFiringColumns = params.Width / 50
	d.step = 0
	d.region0 = htm.NewRegion(params)
	d.region0.RandomizeColumns(params.InputLength / 2)

	params.Name = "1-drop"
	params.Width = 2000
	params.Height = 5
	params.InputLength = d.region0.Output().Len()
	params.MaximumFiringColumns = params.Width / 100
	d.region1 = htm.NewRegion(params)
	d.region1.RandomizeColumns(params.InputLength / 2)

	params.Name = "final"
	params.Width = 200
	params.Height = 3
	params.InputLength = d.region1.Output().Len()
	params.MaximumFiringColumns = 1
	d.region3 = htm.NewRegion(params)
	d.region3.RandomizeColumns(params.InputLength / 2)
	d.predicted = data.NewBitset(d.region3.PredictiveState().Len())
	d.patterns = make(map[string]string)
}
Beispiel #2
0
func NewTpTest(t LoggerInterface) *TpTest {
	params := htm.RegionParameters{
		Name:                 "0-tp",
		Learning:             true,
		Height:               8,
		Width:                64,
		InputLength:          64,
		MinimumInputOverlap:  1,
		MaximumFiringColumns: 2,
	}
	result := &TpTest{
		LoggerInterface: t,
		step:            0,
		inputA:          data.NewBitset(64),
		inputB:          data.NewBitset(64),
		layer0:          htm.NewRegion(params),
		expected0:       data.NewBitset(params.Width * params.Height),
		active0:         data.NewBitset(params.Width * params.Height),
		predicted0:      data.NewBitset(params.Width * params.Height),
		Verify:          true,
	}

	odds := make([]int, 32)
	evens := make([]int, 32)
	for j := 0; j < 32; j++ {
		odds[j] = j + 1
		evens[j] = j
	}

	result.inputA.Set(1)
	result.inputB.Set(8)
	for i := 0; i < params.Width; i++ {
		result.layer0.ResetColumnSynapses(i, i)
	}

	return result
}