averagegradientstatistic.java

来自「神经网络命令行工具」· Java 代码 · 共 57 行

JAVA
57
字号
package com.weighscore.neuro.plugins;

import com.weighscore.neuro.*;

/**
 * This statistic is intended to be used in the future for conjugate gradient
 * teacher.
 * @author Fyodor Kravchenko
 * @version 1.0
 */
public class AverageGradientStatistic extends Statistic {

    /**
     * Counts the number of epochs (the whole case sets);
     */
    public long epochCasesCnt;
    /**
     * The average gradient member for the current epoch
     */
    public double epochCurAgvGradient;
    /**
     * The average gradient member for the previous epoch
     */
    public double epochLastAgvGradient;


    public synchronized void recordTeaching(double correction) {
        //super.recordTeaching(correction);
        epochCurAgvGradient =
            (epochCurAgvGradient * epochCasesCnt + (-1*correction)) /
            (epochCasesCnt + 1);

        epochCasesCnt++;
    }

    public synchronized void nextEpoch(){
        this.epochLastAgvGradient = this.epochCurAgvGradient;
        this.epochCurAgvGradient = 0.0;
        this.epochCasesCnt = 0;
    }

    /**
     * getPerformance
     *
     * @return double
     * @todo implement method
     */
    protected double getPerformance(){return 0.0;}

    public void recordError(double error) {
    }

    public void recordAsking(double question) {
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?