copyVector() public méthode

public copyVector ( ) : Vector
Résultat Vector
Exemple #1
0
	public Vector feedForward(Vector inputVector) {
		lastInput = inputVector;
		Matrix inducedField = weightMatrix.times(inputVector).plus(biasVector);

		Vector inducedFieldVector = new Vector(numberOfNeurons());
		for (int i = 0; i < numberOfNeurons(); i++) {
			inducedFieldVector.setValue(i, inducedField.get(i, 0));
		}

		lastInducedField = inducedFieldVector.copyVector();
		Vector resultVector = new Vector(numberOfNeurons());
		for (int i = 0; i < numberOfNeurons(); i++) {
			resultVector.setValue(i, activationFunction
					.activation(inducedFieldVector.getValue(i)));
		}
		// set the result as the last activation value
		lastActivationValues = resultVector.copyVector();
		return resultVector;
	}
        public Vector calculateBiasUpdates(LayerSensitivity layerSensitivity,
                double alpha, double momentum)
        {
            Layer layer = layerSensitivity.getLayer();
            Matrix biasUpdateMatrixWithoutMomentum = layerSensitivity
                    .getSensitivityMatrix().times(alpha).times(-1.0);

            Matrix biasUpdateMatrixWithMomentum = layer.getLastBiasUpdateVector()
                    .times(momentum).plus(
                            biasUpdateMatrixWithoutMomentum.times(1.0 - momentum));
            Vector result = new Vector(biasUpdateMatrixWithMomentum
                    .getRowDimension());
            for (int i = 0; i < biasUpdateMatrixWithMomentum.getRowDimension(); i++)
            {
                result.setValue(i, biasUpdateMatrixWithMomentum.get(i, 0));
            }
            layer.acceptNewBiasUpdate(result.copyVector());
            return result;
        }
        public static Vector calculateBiasUpdates(
                LayerSensitivity layerSensitivity, double alpha)
        {
            Layer layer = layerSensitivity.getLayer();
            Matrix biasUpdateMatrix = layerSensitivity.getSensitivityMatrix()
                    .times(alpha).times(-1.0);

            Vector result = new Vector(biasUpdateMatrix.getRowDimension());
            for (int i = 0; i < biasUpdateMatrix.getRowDimension(); i++)
            {
                result.setValue(i, biasUpdateMatrix.get(i, 0));
            }
            layer.acceptNewBiasUpdate(result.copyVector());
            return result;
        }