//******************************************************************************* // CSC 143 Computer Programming II Spring 1999 Instructor: Keith Hughes // // Homework 3 // File : \\Venus\katy\CIS143\Homework3\AdalineNetwork\adaline.h // // Purpose : Declaration for AdalineNet classes. // AdalineNet privately inherit NeuralNet // // Author : Hsin-yi F. Berg // Date : 5/9/1999 Sun. // Last Update: 5/28/1999 Fri. //******************************************************************************* #ifndef ADALINE_H #define ADALINE_H #include "NeuralNet.h" #include <iostream.h> #include <fstream.h> /* Adaline Net is a kind of NeuralNet which has only two layers - one input layer with a specified number of Neurons and a output layer with one Neuron. We'll use Generalized Delta Rule to train our Adaline Network. */ // private inheritence because client should not use all function members // in NeuronNet except the one specified in AdalineNet. class AdalineNet:private NeuralNet { public: /* AdalineNet::AdalineNet() Default constructor for an AdalineNet. AdalineNet is created empty. */ AdalineNet(); /* AdalineNet::AdalineNet(int sizeInputLayer) Constructor for an AdalineNet. Set the number of Neurons in the input layer. This function will create a fully connected AdalineNet with two Layers and specified number of Neurons + 1 bias Node in the input Layer. */ AdalineNet(int sizeInputLayer); /* AdalineNet::~AdalineNet() Destructor for an AdalineNet. */ ~AdalineNet(); /* void AdalineNet::SetSizeOfInputLayer(int numInputLayer) Set the number of Neurons in the input layer number of Neurons in the input layer is the only thing we need to know to build a Adaline Network */ void SetSizeOfInputLayer(int numInputLayer); /* void NeuralNet::SetInputValue(int whichNeuron, double Value) Set the value of a specific Neuron in AdalineNet */ void SetInputValue(int whichNeuron, double Value); /* double NeuralNet::GetOutputValue(int whichNeuron) Get the value of a specific Neuron in AdalineNet */ double GetOutputValue(int whichNeuron) const; /* void NeuralNet::Fire(void) Fire the whole AdalineNet */ void Fire(void); /* void AdalineNet::DesiredOutput(double desired_value) This function will calculate and set the error of the output Neuron addording to the desired value. The network should be fired first */ void DesiredOutput(double desired_value); /* void AdalineNet::Learn() This function will propagate the error of output Neuron back to its input Links, adjust the weight of each Link using the rate supplied. */ void Learn(); /* void AdalineNet::SetLearningRate(double rate) Set the learning rate of this Adaline Network */ void SetLearningRate(double rate); /* double AdalineNet::GetLearningRate() Get the learning rate of this Adaline Network */ double GetLearningRate(); /* void AdalineNet::ReadFromFile(istream &in) Read data into this AdalineNet instance from file specified by "in" */ void AdalineNet::ReadFromFile(istream &in); /* void AdalineNet::WriteToFile(ostream &out) Write data of this AdalineNet instance to file specified by "out" */ void AdalineNet::WriteToFile(ostream &out); private: // learning_rate determines how fast the Adaline Network learn // usually it's around 0.25-0.50 (25%-50%) double learning_rate; /* void AdalineNet::BuildStructure(int sizeInputLayer) BuildStructure takes the number of neurons in the input Layer as an argument, build the infrastructure of the Adaline Network. Two-layers, specificied numbers of neurons in the input Layer. */ void BuildStructure(int sizeInputLayer); }; #endif
Back Top