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

📄 bpnlayer.java

📁 JaNet: Java Neural Network Toolkit resume: A well documented toolkit for designing and training, a
💻 JAVA
字号:
////////////////////////////////////////////////////////////////////////////////////  //  //  Copyright (C) 1996 L.  Patocchi & W.Gander////  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;  either  version 2 of the License, or (at your option)//  any later version.////  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; if not, write to the Free Software  Foundation, Inc., 675 Mass//  Ave, Cambridge, MA 02139, USA.////  Contacts://  //    Project Supervisor//      W.Hett       hew@info.isbiel.ch//  //    Authors//      W.Gander     gandw@info.isbiel.ch//      L.Patocchi   patol@info.isbiel.ch////  Documentation can be found at:////      http://www.isbiel.ch/Projects/janet/index.html////////////////////////////////////////////////////////////////////////////////////////// File : BPNLayer.java////////////////////////////////////////////////////////////////////////						BPNLayer base class////////////////////////////////////////////////////////////////////////	Author:  Patocchi L.//	Date:    02.09.1996//	Project: jaNet////	BPNLayer is the base class for a BackPropagation net layer, it//	could be called inputLayer since is the simplets layer in the //	net, without activation-function, or error parameters or ...//	//////////////////////////////////////////////////////////////////////	date		who					what//  02.09.1996	Patocchi L.			creationpackage jaNet.backprop;import java.io.*;public class BPNLayer{	public static final String version = "1.0beta1";	public static final int UNKNOW = 0;	public static final int INPUT  = 1;	public static final int HIDDEN = 2;	public static final int OUTPUT = 3;	protected double 	vector[];	protected int		kind;//////////////////////////////////////////////////////////////////////	Constructors////////////////////////////////////////////////////////////////////	public BPNLayer(){		//this(1);		kind = UNKNOW;	}	public BPNLayer(int n){		//setSize(n);		kind = UNKNOW;	}//////////////////////////////////////////////////////////////////////	initialisers////////////////////////////////////////////////////////////////////	public void reset(){		reset(0.0); 	}	public void reset(double x){		for(int i=0; i<vector.length; i++)vector[i] =   x; 	}//////////////////////////////////////////////////////////////////////	parameter-providers////////////////////////////////////////////////////////////////////	public int getSize(){		return vector.length;	}	public double[] getVector(){		double newVector[] = new double[vector.length];		for(int i=0; i<vector.length; i++)newVector[i] = vector[i];		return newVector;	}	public double getVector(int x) throws BPNException{		if(x <0 || x>=vector.length) throw new BPNException("BPNLayer: Error in getVector(x), <x> under/overflow layer size.");		return vector[x];	}	public double[] getVector(int From, int To) throws BPNException{		if(From > To) throw new BPNException("BPNLayer: Error in getVector(From, To), <From> greather than <To>.");		if(From <0 || To>=vector.length) throw new BPNException("BPNLayer: Error in getVector(From, To), <From> or <To> under/overflow layer size.");		double newVector[] = new double[To - From+1];		for(int i=From; i<=To; i++)newVector[i-From] = vector[i];		return newVector;	}	public int getLayerKind(){		return kind;	}//////////////////////////////////////////////////////////////////////	parameter-modifiers////////////////////////////////////////////////////////////////////	public void setSize(int size){		vector	 = new double[size];		//reset();	}	public void setVector(double[] v) throws BPNException{		if(v == null) throw new BPNException("BPNLayer: Error in setVector(vector), <vector> is null.");		if(v.length!=vector.length) throw new BPNException("BPNLayer: Error in setVector(vector), <vector> length don't match layer length.");				for(int i=0; i<v.length; i++) vector[i] = v[i];	}	public void setVector(double v, int at) throws BPNException{		double x[] = new double[1];		x[0] = v;		setVector(x, at);		x = null;	}	public void setVector(double[] v, int at) throws BPNException{		if(v == null) throw new BPNException("BPNLayer: Error in setVector(vector, at), <vector> is null.");		if(at<0) throw new BPNException("BPNLayer: Error in setVector(vector,at), <at> is negative.");		if(v.length+at>vector.length) throw new BPNException("BPNLayer: Error in setVector(vector,at), <at> + <vector> length overflow layer length.");				for(int i=at; i<v.length+at; i++) vector[i] = v[i-at];	}	public void setLayerKind(int k){		kind = k;	}//////////////////////////////////////////////////////////////////////	transient////////////////////////////////////////////////////////////////////	public void 			propagate() throws BPNException{}	public void 			propagate(double newVector[]) throws BPNException{}	public void 			learn() throws BPNException{}	public String 			getActivationFnClassName(){return null;}	public void 			setActivationFnClass(String name) throws BPNException{}	public BPNWeightPack 	getLowerWeightPack(){return null;}	public void 			setLowerWeightPack(BPNWeightPack uwp){}	public BPNWeightPack 	getUpperWeightPack(){return null;}	public void 			setUpperWeightPack(BPNWeightPack uwp){}	public BPNLayer 		getLowerLayer(){return null;}	public void 			setLowerLayer(BPNLayer layer){}	public BPNLayer 		getUpperLayer(){return null;}	public void 			setUpperLayer(BPNLayer layer){}	public double[] 		getBias(){return null;}	public double 			getBias(int x) throws BPNException{return 0.0;}	public double[] 		getBias(int From, int To) throws BPNException{return null;}	public void 			setBias(double[] b) throws BPNException{}	public void 			setBias(double b){}	public void 			setBias(double v, int at) throws BPNException{}	public void 			setBias(double[] v, int at) throws BPNException{}	public double[] 		getDelta(){return null;}	public double 			getDelta(int x) throws BPNException{return 0.0;}	public double[] 		getDelta(int From, int To) throws BPNException{return null;}		public void 			setLearningRate(double val){}	public void 			setMomentum(double val){}	public void 			writeToFile(RandomAccessFile raf) throws BPNException{}}

⌨️ 快捷键说明

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