6 #include "CUniformRNG.h"
14 const int seglength = 100;
15 const double maxinit = 0.01;
16 const double maxbias = 0.01;
17 const int maxit = 1000;
18 const int hiddenlayers = 2;
19 const double mu = 0.1;
21 ttypeVector typeVector;
23 ifstream inputfile, reffile;
24 ofstream outputfile, epsfile;
26 double currentinput, currentref;
28 string inputfilename, reffilename;
29 string outputfilename, epsfilename;
31 cout <<
"Inputfile: ";
33 cout <<
"Referencefile:";
35 outputfilename = inputfilename +
".clean";
36 epsfilename = inputfilename +
".eps";
37 inputfile.open(inputfilename.c_str());
38 reffile.open(reffilename.c_str());
39 epsfile.open(epsfilename.c_str());
40 outputfile.open(outputfilename.c_str());
42 typeVector.assign(seglength, bipolar);
43 for (
int i = 0; i < hiddenlayers; ++i)
45 typeArray.push_back(typeVector);
48 typeVector.assign(1, identity);
49 typeArray.push_back(typeVector);
52 Network.Input.assign(seglength, 0);
56 for (
int i = 0; i < seglength; ++i)
58 inputfile >> currentinput;
59 Network.Input.at(i) = currentinput;
61 reffile >> currentref;
62 Network.Desired.at(0) = currentref;
64 Network.AdaptWeights();
70 inputfile >> currentinput;
71 reffile >> currentref;
73 rotate(Network.Input.begin(), Network.Input.begin() + 1,
75 Network.Input.back() = currentinput;
77 Network.Desired.at(0) = currentref;
79 Network.AdaptWeights();
81 outputfile << Network.Output.at(0) << endl;
82 epsfile << (Network.Desired.at(0) - Network.Output.at(0)) << endl;
void InitWeights(const double MaxWeight, const double MaxBias)
Initialize the weights with random values with the specified maxima.
void SetLayers(ttypeArray typeArray, bool cachedoutput=false)
Configure the layers of the network according to the types in typeArray.