Somnibyte / MLKit

A simple machine learning framework written in Swift 🤖
MIT License
152 stars 14 forks source link

Add support for multiple hidden layers in NeuralNet #1

Closed niilohlin closed 7 years ago

niilohlin commented 7 years ago

This PR adds support for multiple hidden layers in NeuralNet. However, this breaks some documentation among other things.

Somnibyte commented 7 years ago

Hey @niilohlin, thank you so much for your pull request! The project is much more organized, easier to read, and now more hidden layers can be added thanks to you. I appreciate it! I ran the NeuralNetworkSpec and there was an error with the input layer of a neural network. The issue was that the bias wasn't included so no additional neuron was created (only the ones specified by the user). Here is the fix:

var temporaryWeightsIn: [Float] = []
        var listOfNeurons: [Neuron] = []
        _numberOfNeuronsInLayer = numberOfNeuronsInLayer + 1 // Added Bias 

        for var i in 0..<(numberOfNeuronsInLayer + 1) { // Added Bias 

            var neuron = Neuron()

I'll merge your pull request and make the changes that are needed including some documentation.

Regards, Guled