Пример #1
0
 def test_pcpt_activation(self):
     cInput = random.randint(10, 50)
     listDblTarget = randlist(-0.05, 0.05, cInput)
     listDblW, listDblInput = pairwise_factors(listDblTarget, -0.05, 0.05)
     dblExpected = sum(listDblTarget)
     dblW0 = 0.1 * (random.random() - 0.5)
     pcpt = nn.Perceptron(listDblW, dblW0, random.randint(0, 1000))
     dblResult = nn.pcpt_activation(pcpt, listDblInput)
     self.assertAlmostEqual(dblExpected, logit(dblResult) - dblW0)
Пример #2
0
 def test_pcpt_activation(self):
     cInput = random.randint(10,50)
     listDblTarget = randlist(-0.05,0.05,cInput)
     listDblW,listDblInput = pairwise_factors(listDblTarget,-0.05,0.05)
     dblExpected = sum(listDblTarget)
     dblW0 = 0.1*(random.random() - 0.5)
     pcpt = nn.Perceptron(listDblW, dblW0, random.randint(0,1000))
     dblResult = nn.pcpt_activation(pcpt, listDblInput)
     self.assertAlmostEqual(dblExpected, logit(dblResult) - dblW0)
Пример #3
0
    def test_pcpt_activation(self):
        cInput = random.randint(5, 10)
        dblW0 = random.random() * 0.5
        listDblTarget = randlist(-1.0, 1.0, cInput)
        listDblX, listDblInput = pairwise_factors(listDblTarget, -1.0, 1.0)
        pcpt = nn.Perceptron(listDblX, dblW0, 0)
        dblActivation = nn.pcpt_activation(pcpt, listDblInput)

        dblExpected = sum(listDblTarget)
        dblActual = logit(dblActivation) - dblW0
        self.assertAlmostEqual(dblExpected, dblActual, 4)
Пример #4
0
    def test_pcpt_activation(self):
        cInput = random.randint(5,10)
        dblW0 = random.random()*0.5
        listDblTarget = randlist(-1.0, 1.0, cInput)
        listDblX,listDblInput = pairwise_factors(listDblTarget,-1.0,1.0)
        pcpt = nn.Perceptron(listDblX, dblW0, 0)
        dblActivation = nn.pcpt_activation(pcpt,listDblInput)

        dblExpected = sum(listDblTarget)
        dblActual = logit(dblActivation) - dblW0
        self.assertAlmostEqual(dblExpected, dblActual, 4)