Ejemplo n.º 1
0
    def tet_backward_propagate(self):
        learning_rate = 0.8
        structure = {'num_inputs': 2, 'num_outputs': 1, 'num_hidden': 1}
        candidate = NeuralNet(structure, learning_rate)

        cand_weights = candidate.get_weights()

        X = np.array([np.array([1, 0])])
        Y = np.array([np.array([0])])
        candidate.train(X, Y)

        cand_weights = candidate.get_weights()
        print(cand_weights)

        # You can do the math to see what the new weights should be
        # and assert them here.

        self.assertTrue(True)
Ejemplo n.º 2
0
    def test_weight_shapes(self):
        learning_rate = 0.8
        structure = {'num_inputs': 2, 'num_outputs': 1, 'num_hidden': 5}
        candidate = NeuralNet(structure, learning_rate)

        cand_weights = candidate.get_weights()

        self.assertEqual(cand_weights[0].shape, (3, 5))
        self.assertEqual(cand_weights[1].shape, (5, 1))