/Artificial-Neural-Network

Implementation of a neural network to solve regression and classification problems.

Primary LanguagePython

Artificial-Neural-Network

Implementation of a neural network to solve regression and classification problems.

Content

I have implemented two functions, one for the regression problem and another for the classifiction problem. These fucntions have different parameters that change the way that the neural networks work. The parameters are the following:

  • Data: Is the data that the fucntion will use to learn with (DataFrame).
  • Desire: Is the desire output that the function will try to approximate (DataFrame).
  • Neurons: Is the number of neurons that the neural network will have (List). For example: [2, 1, 2] -> The first layer has 2 neurons, the second layer has only one neuron and the last layer has 2 neurons. The last layer must have the same number of neurons as number of desire outputs.
  • Eta: Controls the steps taken to obtain the gradient vector (Float).
  • Mu: Controls the momentum (Float).
  • Version: Is the way that the function will calculate the errors and backpropagate ('Online' or 'Offline').
  • Function: Is the tyepe of function that the neural networks will use to propagate ('Sigmoid' or 'Hyperbolic').
  • Error Target: When the error is inferior than the error target, the function will stop working (Float).
  • Max Iterations: When the iterations of the method are superior than the max iterations, the function will stop working(Integer)
  • Debug: For each iteration, the user can receive some feedback (Bool)

To solve the problems, the functions have different methods to calculate the backpropagation and adjust the bias. These method are the following:

  • Generate Weights: This function generate random weights for each bias, it takes into account the number of inputs and the number of neurons for each layer.
  • Propagate Inputs: Calculate the outputs depeding in the type of function introduce.
  • Backpropagte Error: Calculate the errors for each neuron backpropagating.
  • Accumulate Change: Calculate the gradients for each bias of each neuron.
  • Adjust Weights: Calculate the new weights.