public Neuron(Vector <double> initialWeights, double bias, double initialBiasWeight, Delegates.ActivationFunction activationFunction) { Weights = initialWeights; Bias = bias; BiasWeight = initialBiasWeight; _activationFunction = activationFunction; }
private void SetDerivativeFunctionType(Delegates.ActivationFunction activationFunction) { if (activationFunction == Functions.SigmoidBipolar) { _derivativeFunction = Functions.SigmoidBipolarDerivative; } else { _derivativeFunction = Functions.SigmoidUnipolarDerivative; } }
public Layer(int numberOfNeurons, int numberOfInputs, Delegates.ActivationFunction activationFunction, Randomizer randomizer) { Neurons = new List <Neuron>(); for (int index = 0; index < numberOfNeurons; index++) { const double bias = 1.0; var initialWeights = randomizer.RandomizeWeights(numberOfInputs); var initialBiasWeight = randomizer.RandomizeBias(); Neurons.Add(new Neuron(initialWeights, bias, initialBiasWeight, activationFunction)); } }
public MultiLayerPerceptron(int numberOfLayers, List <int> inputsPerLayer, List <int> neuronsPerLayer, Delegates.ActivationFunction activationFunction) { _randomizer = new Randomizer(); _layers = new List <Layer>(); _dataReader = new DataReader(); for (int index = 0; index < numberOfLayers; index++) { _layers.Add(new Layer(neuronsPerLayer[index], inputsPerLayer[index], activationFunction, _randomizer)); } SetDerivativeFunctionType(activationFunction); }