acceptNewWeightUpdate() public method

public acceptNewWeightUpdate ( Matrix weightUpdate ) : void
weightUpdate Matrix
return void
コード例 #1
0
        public void processError(Vector error)
        {
            Matrix weightUpdate = error.times(lastInput.transpose());

            layer.acceptNewWeightUpdate(weightUpdate);

            Vector biasUpdate = layer.getBiasVector().plus(error);

            layer.acceptNewBiasUpdate(biasUpdate);
        }
コード例 #2
0
        public static Matrix calculateWeightUpdates(
            LayerSensitivity layerSensitivity,
            Vector previousLayerActivationOrInput, double alpha)
        {
            Layer  layer = layerSensitivity.getLayer();
            Matrix activationTranspose = previousLayerActivationOrInput.transpose();
            Matrix weightUpdateMatrix  = layerSensitivity.getSensitivityMatrix()
                                         .times(activationTranspose).times(alpha).times(-1.0);

            layer.acceptNewWeightUpdate(weightUpdateMatrix.copy());
            return(weightUpdateMatrix);
        }
コード例 #3
0
        public Matrix calculateWeightUpdates(LayerSensitivity layerSensitivity,
                                             Vector previousLayerActivationOrInput, double alpha, double momentum)
        {
            Layer  layer = layerSensitivity.getLayer();
            Matrix activationTranspose = previousLayerActivationOrInput.transpose();
            Matrix momentumLessUpdate  = layerSensitivity.getSensitivityMatrix()
                                         .times(activationTranspose).times(alpha).times(-1.0);
            Matrix updateWithMomentum = layer.getLastWeightUpdateMatrix().times(
                momentum).plus(momentumLessUpdate.times(1.0 - momentum));

            layer.acceptNewWeightUpdate(updateWithMomentum.copy());
            return(updateWithMomentum);
        }