⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 synapse.java

📁 一个纯java写的神经网络源代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                --bitems;                b_pattern.setArray(bouts);                revLock.notify();                return b_pattern;            } else {                //bitems = 0;                revLock.notify();                return null;            }        }    }        public void revPut(Pattern pattern) {        if (isEnabled()) {            synchronized (getRevLock()) {                while (bitems > 0) {                    try {                        revLock.wait();                    } catch (InterruptedException e) {                        reset();                        revLock.notify();                        return;                    }                }                b_pattern = pattern;                count = b_pattern.getCount();                backward(pattern.getArray());                ++bitems;                notFirstTimeB = true;                revLock.notify();            }        }    }        /**     * Insert the method's description here.     * Creation date: (23/09/2000 12.52.58)     */    protected abstract void setArrays(int rows, int cols);        /**     * Dimensiona l'elemento     * @param int rows - righe     * @param int cols - colonne     */    protected abstract void setDimensions(int rows, int cols);        /** Sets the number of the ignored cycles at beginning of each epoch.     * During these cycles the synapse is disabled.     * Useful when the synapse is attached as the Input2 of a SwitchSynapse     *     * @param newIgnoreBefore int     * @see SwitchSynapse     */    public void setIgnoreBefore(int newIgnoreBefore) {        ignoreBefore = newIgnoreBefore;    }        /** Sets the input dimension of the synapse     * @param newInputDimension int     */    public void setInputDimension(int newInputDimension) {        if (inputDimension != newInputDimension) {            inputDimension = newInputDimension;            setDimensions(newInputDimension, -1);        }    }        /** Sets the value of the learning rate     * @param newLearningRate double     */    public void setLearningRate(double newLearningRate) {        learningRate = newLearningRate;    }        /** Sets the value of the momentum rate     * @param newMomentum double     */    public void setMomentum(double newMomentum) {        momentum = newMomentum;    }        /** Sets the Monitor object of the synapse     * @param newMonitor neural.engine.Monitor     */    public void setMonitor(Monitor newMonitor) {        monitor = newMonitor;        if (monitor != null) {            setLearningRate(monitor.getLearningRate());            setMomentum(monitor.getMomentum());        }    }        /** Sets the name of the synapse     * @param name The name of the component.     * @see #getName     */    public void setName(java.lang.String name) {        fieldName = name;    }        /** Sets the output dimension of the synapse     * @param newOutputDimension int     */    public void setOutputDimension(int newOutputDimension) {        if (outputDimension != newOutputDimension) {            outputDimension = newOutputDimension;            setDimensions(-1, newOutputDimension);        }    }        /** Getter for property enabled.     * @return Value of property enabled.     */    public boolean isEnabled() {        return enabled;    }        /** Setter for property enabled.     * @param enabled New value of property enabled.     */    public void setEnabled(boolean enabled) {        this.enabled = enabled;    }        /** Getter for property loopBack.     * @return Value of property loopBack.     *     */    public boolean isLoopBack() {        return loopBack;    }        /** Setter for property loopBack.     * @param loopBack New value of property loopBack.     *     */    public void setLoopBack(boolean loopBack) {        this.loopBack = loopBack;    }        /**     * Base for check messages.     * Subclasses should call this method from thier own check method.     *     * @see InputPaternListener     * @see OutputPaternListener     * @return validation errors.     */    public TreeSet check() {                // Prepare an empty set for check messages;        TreeSet checks = new TreeSet();                // Return check messages        return checks;    }        public Collection Inspections() {        Collection col = new ArrayList();        col.add(new WeightsInspection(array));        return col;    }        public String InspectableTitle() {        return this.getName();    }        /** Getter for property inputFull.     * @return Value of property inputFull.     *     */    public boolean isInputFull() {        return inputFull;    }        /** Setter for property inputFull.     * @param inputFull New value of property inputFull.     *     */    public void setInputFull(boolean inputFull) {        this.inputFull = inputFull;    }        /** Getter for property outputFull.     * @return Value of property outputFull.     *     */    public boolean isOutputFull() {        return outputFull;    }        /** Setter for property outputFull.     * @param outputFull New value of property outputFull.     *     */    public void setOutputFull(boolean outputFull) {        this.outputFull = outputFull;    }        /** Getter for the internal matrix of weights     *     * @return the Matrix containing the 2D array of weights     */    public Matrix getWeights() {        return array;    }        /** Setter for the internal matrix of weights     *     * @param the Matrix containing the 2D array of weights     */    public void setWeights(Matrix newWeights) {        array = newWeights;    }        /** Returns the appropriate Learner object for this class     * depending on the Monitor.learningMode property value     * @return the Learner object if applicable, otherwise null     * @see org.joone.engine.Learnable#getLearner()     */    public Learner getLearner() {        if (!learnable) {            return null;        }        return getMonitor().getLearner();    }        /** Initialize the Learner object     * @see org.joone.engine.Learnable#initLearner()     */    public void initLearner() {        myLearner = getLearner();        if(myLearner != null) {            myLearner.registerLearnable(this);        }    }        /**     * Getter for property fwdLock.     * @return Value of property fwdLock.     */    protected Object getFwdLock() {        if (fwdLock == null)            fwdLock = new Object();        return fwdLock;    }            /**     * Getter for property revLock.     * @return Value of property revLock.     */    protected Object getRevLock() {        if (revLock == null)            revLock = new Object();        return revLock;    }        /** Synapse's initialization.     * It needs to be invoked at the starting of the neural network     * It's called within the Layer.init() method     */    public void init() {        this.initLearner();        this.getFwdLock();        this.getRevLock();    }    }

⌨️ 快捷键说明

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