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

📄 shuffleplugin.java

📁 一个纯java写的神经网络源代码
💻 JAVA
字号:
/* * ShufflePlugin.java * * Created on 11 febbraio 2004, 14.59 */package org.joone.util;import org.joone.engine.Pattern;/** This plugin shuffles the content of the input buffer * by mixing randomly the rows. * * @author  P.Marrone */public class ShufflePlugin extends ConverterPlugIn {         static final long serialVersionUID = 7118539833128121178L;         /** Creates a new instance of ShufflePlugin */    public ShufflePlugin() {        setApplyEveryCycle(true);        setAdvancedSerieSelector("1");    }        protected boolean convert(int serie) {        // We don't need to apply any conversion to the columns        return false;    }        protected boolean applyOnRows() {        boolean retValue = false;        int s = getInputVector().size();        for (int i=0; i < s; ++i) {            int n = i;            while (n == i) {                // Extracts an integer between 0 and s - 1                n = Math.round((float)(Math.random() * s));                n = (n > 0) ? n - 1: 0;            }            // Now exchanges the elements at n,i            Pattern p1 = (Pattern)getInputVector().elementAt(i);            Pattern p2 = (Pattern)getInputVector().elementAt(n);            getInputVector().set(n, p1);            getInputVector().set(i, p2);            retValue = true;        }        return retValue;    }    }

⌨️ 快捷键说明

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