#ifndef NNET_H #define NNET_H /////////////////////////////////////////////////////////////// // // // nnet.h - model neural network // // // // version: 2.0 // // Language: Visual C++, ver 5.0 // // Platform: Micron Dual Pentium Pro 200 // // Windows NT 4.0, service pack 3 // // Application: ELE591/791 Example // // Author: Jim Fawcett // // CST 2-187, (315) 443-3948 // // fawcett@neptune.syr.edu // // // /////////////////////////////////////////////////////////////// /* nnet operations: ================ This class models the operation of a neural net using layers which are composed of either sigmoid neurons or linear neurons (only one type allowed in each layer). The networks represented by the nnet class are fully connected. That is, every input connects to every hidden layer neuron and every hidden neuron output connects to every output layer neuron. A virtual function is provided in the layer class so that you disconnect some of its neurons by setting weights to zero. Network weights are updated by the backpropogation process during learning and are held fixed during normal operations. nnet Public Interface: ====================== nnet myNet(hidden, output); // construct network from layers myNet.outputs(inVec, outVec); // compute output from input vector myNet.randWts(min,max,true); // randomize wts from min to max // with new seed if true myNet.upDateWts(error); // employ backpropagation on error // vector myNet.logWts(outLog, hidLog); // log norms of output weights and // hidden weights to these streams */ // ///////////////////////////////////////////////////////////////// // // // Build Process // // ------------- // // Files required: // // nnet.h, nnet.cpp, layer.h, layer.cpp, // // bneuron.h, bneuron.cpp, vec,h, vec.cpp // // // // build command for Neptune cluster with VC++ 5.0: // // I:\fawcett\ecs500\setenv.bat (neptune only) // // cl -GX -DTEST_NNET nnet.cpp layer.cpp bneuron.cpp vec.cpp // // // ///////////////////////////////////////////////////////////////// /* Maintenance History ------------------- ver 2.0 : 11 July 98 - radically altered design ver 1.0 : 30 June 98 - first release */ class nnet { public: nnet(layer &hidden, layer &output); virtual ~nnet() { } void outputs(const vec &inputs, vec &outputs); void randWts(double min, double max, bool newSeed); virtual void updateWts(vec &error); virtual void logWts(ostream &outLog, ostream &hidLog); private: layer _hidden; layer _output; }; #endif