📄 inputlayer.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 : inputLayer.java//////////////////////////////////////////////////////////////////////// inputLayer extending class//////////////////////////////////////////////////////////////////////// Author: Patocchi L.// Date: 02.09.1996// Project: jaNet//// inputLayer is the extended BPNLayer class for a BackPropagation // input layer.// ////////////////////////////////////////////////////////////////////// date who what// 02.09.1996 Patocchi L. creationpackage jaNet.backprop;import java.io.*;public class inputLayer extends BPNLayer{ protected BPNLayer lowerLayer; protected BPNWeightPack lowerWeights;////////////////////////////////////////////////////////////////////// Constructors//////////////////////////////////////////////////////////////////// public inputLayer(){ this(1); } public inputLayer(int n){ setSize(n); }////////////////////////////////////////////////////////////////////// I/O ports//////////////////////////////////////////////////////////////////// public void writeToFile(RandomAccessFile raf) throws BPNException{ try{ raf.writeUTF(getClass().getName()+version); int size = getSize(); raf.writeInt(size); }catch(IOException ioe){ throw new BPNException("outputLayer: Error in writeToFile,("+ioe+")."); } } public static inputLayer readFromFile(RandomAccessFile raf) throws BPNException{ int upper, lower; inputLayer temp = new inputLayer(); try{ if(raf.readUTF().compareTo(temp.getClass().getName()+version) != 0){ throw new BPNException("inputLayer: Error in readFromFile, unknown version."); } // setup size of tables in temporary variables int size = raf.readInt(); temp = new inputLayer(size); }catch(IOException ioe){ throw new BPNException("outputLayer: Error in readFromFile,("+ioe+")."); } return temp; }////////////////////////////////////////////////////////////////////// Plug-in's (activating function, layers, weights pack)//////////////////////////////////////////////////////////////////// public void setLowerLayer(BPNLayer layer){ lowerLayer = layer; } public BPNLayer getLowerLayer(){ return lowerLayer; } public void setLowerWeightPack(BPNWeightPack uwp){ lowerWeights = uwp; } public BPNWeightPack getLowerWeightPack(){ return lowerWeights; }////////////////////////////////////////////////////////////////////// neural network input layer functionalities//////////////////////////////////////////////////////////////////// public void propagate() throws BPNException{ // propagate actual layer state; propagate(vector); } public void propagate(double newVector[]) throws BPNException{ // set vector as actual input setVector(newVector); // stroke next layer for propagation lowerLayer.propagate(); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -