public Layer( WeightsMatrix weights, NetworkVector biases, ActivationFunction activationfunction, DerivativeFunction derivativefunction ) : base(weights.NumberOfOutputs, weights.NumberOfInputs) { if (activationfunction != null && derivativefunction == null) { throw new ArgumentException("derivativefunction cannot be null, if activatioin is not null"); } if (weights == null || biases == null) { throw new ArgumentException("Attempt to make a layer with null weights or biases."); } _combiner = new WeightedCombiner(weights, biases); if (activationfunction == null) { _neuralFunction = null; } else { _neuralFunction = new NeuralFunction(_combiner.NumberOfOutputs, activationfunction, derivativefunction); } }
public Layer(double[,] weights, double[] biases, TrainingMode mode) : base(mode) { int numberOfOutputs = weights.GetLength(0); int numberOfInputs = weights.GetLength(1); _combiner = new WeightedCombiner(weights, biases); _neuralFunction = null; }
public Layer(double[,] weights, ActivationFunction activationfunction, DerivativeFunction derivativefunction) : this(weights) { if (activationfunction != null && derivativefunction == null) { throw new ArgumentException("derivativefunction cannot be null, if activatioin is not null"); } _neuralFunction = new NeuralFunction(NumberOfOutputs, activationfunction, derivativefunction); }
protected Layer(Layer layer) : base(layer.Mode) { if (layer == null) { throw new ArgumentException("Attempt to create a LayerBank with a null layer."); } _combiner = layer._combiner; _neuralFunction = layer._neuralFunction; }