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, ActivationFunction activationfunction, DerivativeFunction derivativefunction) : this(weights, biases, activationfunction, derivativefunction, TrainingMode.ONLINE) { }
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); }
public NeuralFunction(int numberOfUnits, ActivationFunction activationfunction, DerivativeFunction derivativefunction, double[] biases = null) : this(numberOfUnits) { if (activationfunction != null && derivativefunction == null) { throw new ArgumentException("derivativefunction cannot be null, if activation is not null"); } _neuralFunction = activationfunction; _neuralFunctionDerivative = derivativefunction; }
public Layer( WeightsMatrix weights, BiasesVector biases, ActivationFunction activationfunction, DerivativeFunction derivativefunction ) : base(weights, biases) { if (weights == null || biases == null) { throw new ArgumentException("Attempt to make a layer with null weights or biases."); } if (activationfunction == null) { _neuralFunction = null; } else { _neuralFunction = new NeuralFunction(NumberOfOutputs, activationfunction, derivativefunction); } }
/// <summary> /// Calculates the per-second derivative of the time series in a range vector, using simple linear regression. /// </summary> /// <returns></returns> public InstantVector Derivative() { AddAction(DerivativeFunction.Create()); return(InstantVector.WithString(this)); }