Draft

Basic Neural Network Implementation

Description
Loading description...
Networks
Neural Networks
NumPy
Arrays
Machine Learning
Artificial Intelligence
  • Please sign in or sign up to leave a comment.
  • Voile Avatar

    Error margin is set up 0.55 and 5, but assert_approx_equals accepts maximum of relative/absolute error, which means the fixed tests accept +-0.55, and the random tests will accept everything.

    It also means no training is neccessary to pass the kata: see this

    • JakeRigney Avatar

      That completely slipped my head, I was troubleshooting something and failed to remember to update that! Thanks for telling me!

  • Voile Avatar
        @test.it("Test Neural Network Initialization")
        def _():
            nn = SimpleNeuralNetwork(3, 4, 2)
            test.assert_equals(len(nn.hidden_weights), 3)
            test.assert_equals(len(nn.hidden_weights[0]), 4)
            test.assert_equals(len(nn.output_weights), 4)
            test.assert_equals(len(nn.output_weights[0]), 2)
    
        @test.it("Test Forward Pass")
        def _():
            nn = SimpleNeuralNetwork(3, 4, 2)
            inputs = np.random.rand(1, 3)
            output = nn.forward_pass(inputs)
            test.assert_equals(output.shape, (1, 2))
    

    These tests are testing the specific implementation details that was not mentioned in the description at all.

    Meanwhile, calculate_loss is not tested at all. So it's very unclear what is actually meant to be tested.

    • JakeRigney Avatar

      Thanks for the note, I completely forgot to add a test for calculate_loss.

      For @test.it("Test Neural Network Initialization"): These checks ensure that your network's weights are of the correct shape as per the architecture defined in the initialization (SimpleNeuralNetwork(3, 4, 2)).

      And lastly @test.it("Test Forward Pass"): This test ensures that when your neural network receives an input, it processes the input correctly through its layers and produces an output with the expected dimensions.

      I thought future people attempting this would know what a forward pass was since it should be neural network fundamentals... but i'll be happy to update the description and clarify! Thanks a lot for your take on this, i'll update the description as soon as I implement the calculate loss test case. :)

  • Ciprian Amza Avatar

    This comment has been hidden.