def test_thresholdH(self): self.assertEqual(self.test.thresholdH(0.5), 1) self.assertEqual(self.test.thresholdH(-0.5), 0) self.assertEqual(self.test.thresholdH(0), 0) # test logistic thresholding test2 = pcn.neuron(2, thresh_type = "logistic") self.assertEqual(test2.thresholdH(0.9) > 0.5, 1) self.assertEqual(test2.thresholdH(-0.3) > 0.5, 0)
def test_seed_init_2(self): dtNow = dt.datetime.now() numNow = int(str(dtNow.year) + str(dtNow.month).zfill(2) + str(dtNow.day).zfill(2)) test2 = pcn.neuron(1) self.assertEqual(test2.seed, numNow)
def test_thresh_type_init_2(self): test2 = pcn.neuron(2, thresh_type = "logistic") self.assertEqual(test2.thresh_type, 'logistic') test2 = pcn.neuron(2, thresh_type = 'soft-max') self.assertEqual(test2.thresh_type, 'soft-max')
def setUp(self): self.test = pcn.neuron(3) self.data = np.matrix([[-1, 0, 0], [-1, 0, 1], [-1, 1, 0], [-1, 1, 1]]) self.target1 = np.matrix([[0], [0], [0], [1]]) self.target2 = np.matrix([[0], [1], [1], [1]])