Пример #1
0
func TestDeriv(t *testing.T) {
	for i, test := range netIniters {
		for _, nSamples := range nSampleSlice {
			n := testNets[i]
			inputs := regtest.RandomMat(nSamples, test.inputDim, rand.NormFloat64)
			trueOutputs := regtest.RandomMat(nSamples, test.outputDim, rand.NormFloat64)
			regtest.TestDeriv(t, n, inputs, trueOutputs, test.name)
		}
	}
}
Пример #2
0
func TestPublicPredictAndBatch(t *testing.T) {
	for i, test := range netIniters {
		for _, nSamples := range nSampleSlice {
			n := testNets[i]
			inputs := regtest.RandomMat(nSamples, test.inputDim, rand.NormFloat64)
			trueOutputs := regtest.RandomMat(nSamples, test.outputDim, rand.NormFloat64)

			for j := 0; j < nSamples; j++ {
				tmp1, tmp2 := newPredictMemory(n.neurons)
				predict(inputs.RowView(j), n.neurons, n.parameters, tmp1, tmp2, trueOutputs.RowView(j))
				//predict(inputs.RowView(j), s.features, s.b, s.featureWeights, trueOutputs.RowView(j))
			}

			regtest.TestPredictAndBatch(t, n, inputs, trueOutputs, test.name)
		}
	}
}