public TrainableComponent(WeightsMatrix weights, BiasesVector biases) : base(weights.NumberOfInputs, weights.NumberOfOutputs) { if (weights.NumberOfOutputs != biases.Dimension) { throw new ArgumentException("Mismatched WeightsMatrix and BiasesVector."); } _weights = weights; _biases = biases; Strategy = new NeuralNet.GradientDescent(); // default - keep this here? }
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); } }
public WeightsMatrix Add(WeightsMatrix other) { return(new WeightsMatrix(AddMatrices(this, other))); }
public override NeuralNet2.WeightsMatrix WeightsUpdate(NeuralNet2.WeightsMatrix gradient) { Matrix delta = gradient.Scale(-_stepSize / _batchSize); return(new NeuralNet2.WeightsMatrix(delta)); }
public abstract NeuralNet2.WeightsMatrix WeightsUpdate(NeuralNet2.WeightsMatrix gradient);
public static Layer CreateLinearLayer(WeightsMatrix weights, BiasesVector biases) { return(new Layer(weights, biases, null, null)); }
public Layer(WeightsMatrix weights) : this(weights, new BiasesVector(weights.NumberOfOutputs), null, null) { }
public Layer(WeightsMatrix weights, BiasesVector biases) : this(weights, biases, null, null) { }
public static Layer CreateLogisticLayer(WeightsMatrix weights) { return(new Layer(weights, new BiasesVector(weights.NumberOfOutputs), NeuralFunction.__Logistic, NeuralFunction.__LogisticDerivative)); }
public static Layer CreateLogisticLayer(WeightsMatrix weights, BiasesVector biases) { return(new Layer(weights, biases, NeuralFunction.__Logistic, NeuralFunction.__LogisticDerivative)); }
public static Layer CreateLinearLayer(WeightsMatrix weights) { return(new Layer(weights, new BiasesVector(weights.NumberOfOutputs), null, null)); }
protected override void _updateWeights(VectorBatch outputGradient) { WeightsMatrix weightsGradient = WeightsMatrix.FromVectorBatchPair(_input, _activationGradient); _weights = _weights.Add(Strategy.WeightsUpdate(weightsGradient)); }
public WeightedCombiner(WeightsMatrix weights) : this(weights, new BiasesVector(weights.NumberOfOutputs)) { }
public WeightedCombiner(WeightsMatrix weights, BiasesVector biases) : base(weights, biases) { }