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

📄 multiplierfactory.java

📁 jooneDTE的源码
💻 JAVA
字号:
/* * MultiplierFactory.java * * Created on 11 luglio 2004, 20.52 */package org.joone.dte.factory;import org.joone.net.NeuralNet;import java.util.ArrayList;import org.joone.dte.TaskListFactory;/** * This class gets in input a TaskList and generates N copies * of each element of the list. * Moreover, if noise > 0.0, for each generated element: * If randomize = false: applyes a noise to the weights * If randomize = true: initialize the weights  * * @author  paolo */public class MultiplierFactory extends TaskListFactory {    private int copies;    private double noise = 0.0;    private boolean randomize = false;    private int currElem;    private NeuralNet currNet = null;        /** Creates a new instance of MultiplierFactory */    public MultiplierFactory() {        copies = 1;        noise = 0.0;    }        public void initialize() {        super.initialize();        currElem = 0;    }        /**     * Getter for property copies.     * @return Value of property copies.     */    public int getCopies() {        return copies;    }        /**     * Setter for property copies.     * @param copies New value of property copies.     */    public void setCopies(int copies) {        this.copies = copies;    }        /**     * Getter for property noise.     * @return Value of property noise.     */    public double getNoise() {        return noise;    }        /**     * Setter for property noise.     * @param noise New value of property noise.     */    public void setNoise(double noise) {        this.noise = noise;    }            public NeuralNet getNextTask() {        if ((currNet == null) || (currElem == 0)) {            currNet = super.getNextTask();            currElem = copies;        }        NeuralNet nnet = null;        if (currNet != null) {            nnet = currNet.cloneNet();            if (noise > 0.0)                nnet.addNoise(noise);            --currElem;        }        return nnet;    }        public int getTotTasks() {        return super.getTotTasks() * copies;    }        /**     * Getter for property randomize.     * @return Value of property randomize.     */    public boolean isRandomize() {        return randomize;    }        /**     * Setter for property randomize.     * @param randomize New value of property randomize.     */    public void setRandomize(boolean randomize) {        this.randomize = randomize;    }    }

⌨️ 快捷键说明

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