コード例 #1
0
 public void propagateForward(Matrix input) {
   NeuralNetwork nn = getNeuralNetwork();
   Set<Layer> calculatedLayers = new UniqueList<Layer>();
   calculatedLayers.add(nn.getInputLayer());
   activations.addValues(nn.getInputLayer(), input);
   nn.getLayerCalculator().calculate(nn, nn.getOutputLayer(), calculatedLayers, activations);
 }
コード例 #2
0
  public void propagateBackward(Matrix target) {
    NeuralNetwork nn = getNeuralNetwork();

    OutputErrorDerivative d = getProperties().getParameter(Constants.OUTPUT_ERROR_DERIVATIVE);
    Matrix outputErrorDerivative =
        d.getOutputErrorDerivative(activations.getValues(nn.getOutputLayer()), target);
    backpropagation.addValues(nn.getOutputLayer(), outputErrorDerivative);
    Set<Layer> calculatedLayers = new UniqueList<Layer>();
    calculatedLayers.add(nn.getOutputLayer());
    BackPropagationLayerCalculator blc = getBPLayerCalculator();
    blc.backpropagate(nn, calculatedLayers, activations, backpropagation);
  }