src/core/optimization/Adadelta.java
public void optimize(Matrix matrix, Matrix matrixGradient) throws MatrixException, DynamicParamException {
        if (eg2 == null) eg2 = new HashMap<>();
        Matrix mEg2;
        if (eg2.containsKey(matrix)) mEg2 = eg2.get(matrix);
        else eg2.put(matrix, mEg2 = new DMatrix(matrix.getRows(), matrix.getColumns()));

        if (ed2 == null) ed2 = new HashMap<>();
        Matrix mEd2;
        if (ed2.containsKey(matrix)) mEd2 = ed2.get(matrix);
        else ed2.put(matrix, mEd2 = new DMatrix(matrix.getRows(), matrix.getColumns()));

        mEg2 = mEg2.multiply(gamma).add(matrixGradient.power(2).multiply(1 - gamma));

        double epsilon = 10E-8;
        Matrix Ed = mEd2.add(epsilon).apply(UnaryFunctionType.SQRT).divide(mEg2.add(epsilon).apply(UnaryFunctionType.SQRT)).multiply(matrixGradient);
        matrix.subtract(Ed.multiply(learningRate), matrix);
        mEd2 = mEd2.multiply(gamma).add(Ed.power(2).multiply(1 - gamma));

        eg2.put(matrix, mEg2);
        ed2.put(matrix, mEd2);
    }
/**
     * Optimizes single matrix (M) using calculated matrix gradient (dM).<br>
     * Matrix can be for example weight or bias matrix with gradient.<br>
     *
     * @param matrix matrix to be optimized.
     * @param matrixGradient matrix gradients for optimization step.
     * @throws MatrixException throws exception if matrix operation fails.
     * @throws DynamicParamException throws exception if parameter (params) setting fails.
     */
Optimizes single matrix (M) using calculated matrix gradient (dM).
Matrix can be for example weight or bias matrix with gradient.

@param matrix matrix to be optimized.
@param matrixGradient matrix gradients for optimization step.
@throws MatrixException throws exception if matrix operation fails.
@throws DynamicParamException throws exception if parameter (params) setting fails.
Optimizes single matrix ( M ) using calculated matrix gradient ( dM ) . Matrix can be for example weight or bias matrix with gradient . @param matrix matrix to be optimized . @param matrixGradient matrix gradients for optimization step . @throws MatrixException throws exception if matrix operation fails . @throws DynamicParamException throws exception if parameter ( params ) setting fails .
public void optimize(Matrix matrix, Matrix matrixGradient) throws MatrixException, DynamicParamException {
        if (eg2 == null) eg2 = new HashMap<>();
        Matrix mEg2;
        if (eg2.containsKey(matrix)) mEg2 = eg2.get(matrix);
        else eg2.put(matrix, mEg2 = new DMatrix(matrix.getRows(), matrix.getColumns()));
        if (ed2 == null) ed2 = new HashMap<>();
        Matrix mEd2;
        if (ed2.containsKey(matrix)) mEd2 = ed2.get(matrix);
        else ed2.put(matrix, mEd2 = new DMatrix(matrix.getRows(), matrix.getColumns()));
        mEg2 = mEg2.multiply(gamma).add(matrixGradient.power(2).multiply(1 - gamma));
        double epsilon = 10E-8;
        Matrix Ed = mEd2.add(epsilon).apply(UnaryFunctionType.SQRT).divide(mEg2.add(epsilon).apply(UnaryFunctionType.SQRT)).multiply(matrixGradient);
        matrix.subtract(Ed.multiply(learningRate), matrix);
        mEd2 = mEd2.multiply(gamma).add(Ed.power(2).multiply(1 - gamma));
        eg2.put(matrix, mEg2);
        ed2.put(matrix, mEd2);
    }
public void optimize ( Matrix matrix , Matrix matrixGradient ) throws MatrixException , DynamicParamException { if ( eg2 == null ) eg2 = new HashMap < > ( ) ; Matrix mEg2 ; if ( eg2 . containsKey ( matrix ) ) mEg2 = eg2 . get ( matrix ) ; else eg2 . put ( matrix , mEg2 = new DMatrix ( matrix . getRows ( ) , matrix . getColumns ( ) ) ) ; if ( ed2 == null ) ed2 = new HashMap < > ( ) ; Matrix mEd2 ; if ( ed2 . containsKey ( matrix ) ) mEd2 = ed2 . get ( matrix ) ; else ed2 . put ( matrix , mEd2 = new DMatrix ( matrix . getRows ( ) , matrix . getColumns ( ) ) ) ; mEg2 = mEg2 . multiply ( gamma ) . add ( matrixGradient . power ( 2 ) . multiply ( 1 - gamma ) ) ; double epsilon = 10E-8 ; Matrix Ed = mEd2 . add ( epsilon ) . apply ( UnaryFunctionType . SQRT ) . divide ( mEg2 . add ( epsilon ) . apply ( UnaryFunctionType . SQRT ) ) . multiply ( matrixGradient ) ; matrix . subtract ( Ed . multiply ( learningRate ) , matrix ) ; mEd2 = mEd2 . multiply ( gamma ) . add ( Ed . power ( 2 ) . multiply ( 1 - gamma ) ) ; eg2 . put ( matrix , mEg2 ) ; ed2 . put ( matrix , mEd2 ) ; }
Optimizes single matrix (M) using calculated matrix gradient (dM).<br>
 Matrix can be for example weight or bias matrix with gradient.<br>
Optimizes single matrix ( M ) using calculated matrix gradient ( dM ) . <br > Matrix can be for example weight or bias matrix with gradient . <br >