netchecker.java

来自「一个纯java写的神经网络源代码」· Java 代码 · 共 53 行

JAVA
53
字号
package org.joone.net;import org.joone.net.NeuralNet;import java.util.*;public class NetChecker {    /** NeuralNet linked to this instance. */    final private NeuralNet netToCheck;    /**     * Constructor. Sets the NeuralNet for this instance.     *     * @param netToCheckArg the NeuralNEt to use.     */    public NetChecker(NeuralNet netToCheckArg) {        netToCheck = netToCheckArg;    }    /**     * Validation checks for invalid parameter values, misconfiguration, etc.     * All network components should include a check method that firstly calls its ancestor check method and     * adds these to any check messages it produces. This allows check messages to be collected from all levels     * of a component to be returned to the caller's check method. Using a TreeSet ensures that     * duplicate messages are removed. Check messages should be produced using the generateValidationErrorMessage     * method of the NetChecker class.     *     * @return validation errors.     */    public TreeSet check() {        return netToCheck.check();    }    /**     * Method to determine whether there are validation errors in the net.     *     * @return true if errors exist.     */    public boolean hasErrors() {        TreeSet checks = netToCheck.check();        Iterator iter = checks.iterator();        while (iter.hasNext()) {            NetCheck netCheck = (NetCheck) iter.next();            if (netCheck.isFatal()) {                return true;            }        }        return false;    }}

⌨️ 快捷键说明

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