class TestNeuNet(TestCase): def setUp(self): projectRootPath = '/'.join(__file__.replace('\t', '/t').replace('\\', '/').split('/')[:-2]) + '/testDataSet/' forwardWeightAllLayers = loadmat(projectRootPath + 'Theta1.mat')['Theta1'], loadmat(projectRootPath + 'Theta2.mat')['Theta2'] layersExOutputLy = (NnLayer(sigmoid, 400, 1, 25), NnLayer(sigmoid, 25, 1, 10)) layersExOutputLy[0].updateForwardWeight(forwardWeightAllLayers[0]) layersExOutputLy[1].updateForwardWeight(forwardWeightAllLayers[1]) self.inputs = loadmat(projectRootPath + 'X.mat')['X'] self.outputs = loadmat(projectRootPath + 'forwardPropOutputs.mat')['actualOutput'] self.nn = FeedforwardNeuNet(layersExOutputLy, 1, 0.05, 1) def test_forwardPropogateOneInput(self): self.nn.forwardPropogateOneInput(self.inputs[0]) assert_array_almost_equal(self.nn, self.outputs[0]) def test_forwardPropogateAllInput(self): result = self.nn.forwardPropogateAllInput(self.inputs) assert_array_almost_equal(result, self.outputs)