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

📄 layer.java

📁 用Java实现的多层BP神经网络
💻 JAVA
字号:
/*  AI ANN Backpropagation    Copyright (C) 2002-2003  Wim Gillis <d.e.m@gmx.net>    http://sourceforge.net/projects/crap    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program (see COPYING); if not, check out     http://www.gnu.org/licenses/gpl.html    or write to the Free Software Foundation,     Inc., 59 Temple Place, Suite 330, Boston,     MA  02111-1307  USA*/package cx.ma.ai.ann.backprop;import java.io.Serializable;public class Layer implements Serializable{        private Neuron[] neurons;        public Layer(int noOfNeurons, Layer previousLayer, double weightDefaultValue, int activationType) {        neurons = new Neuron[noOfNeurons];         for (int i = 0; i < neurons.length; ++i) {            if (previousLayer != null)                 neurons[i] = new Neuron(previousLayer.getNoOfNeurons(), weightDefaultValue, activationType);               else                    neurons[i] = new Neuron(0, 0, activationType);        }    }        public Layer(Layer layer) {        neurons = new Neuron[layer.getNoOfNeurons()];        for (int i = 0; i < layer.getNoOfNeurons(); ++i) {            neurons[i] = new Neuron (layer.getNeuron (i));        }    }        public int getNoOfNeurons(){        return neurons.length;    }        public Neuron getNeuron(int index){        return neurons[index];    }        public void calculateNets(Layer previousLayer){        for (int i = 0; i < neurons.length; ++i)            neurons[i].calculateNet (previousLayer);    }        public String toString(){        String out = "";        for (int i = 0; i < neurons.length; ++i)            out += "\t\tNeuron " + i + "\n" + neurons[i].toString() + "\n";        return out;    }}

⌨️ 快捷键说明

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