// NetQuality.h // copyright 6 August 1997 Kevin Karplus #ifndef NetQuality_H #define NetQuality_H // NetQuality provides an array of QualityRecord for a neural network // Since the class is so simple, it is entirely contained in this .h file #include "NeuralNet.h" #include "QualityRecord.h" class NetQuality { NeuralNet *Net; int NumLayers; // for consistency check that Net hasn't expanded. QualityRecord **QR; // array of NumLayers QualityRecord, one for each // layer of the net public: NetQuality(NeuralNet *n) { Net=n; NumLayers=n->num_layers(); QR = new QualityRecord*[NumLayers]; for (int k=0; klayer(k)); } NetQuality(const NetQuality *old) { Net= old->Net; NumLayers= old->NumLayers; QR = new QualityRecord*[NumLayers]; for (int k=0; kQR[k]); } ~NetQuality(void) { for (int k=0; k=0 && layerobjective(); } inline double encoding_cost(int layer) const { assert(layer>=0 && layerencoding_cost(); } inline double q(int layer) const { assert(layer>=0 && layerq(); } inline double SOV(int layer) const { assert(layer>=0 && layerSOV(0); } inline double rms_sum(int layer) const { assert(layer>=0 && layerrms_sum(); } inline double rms_sum2_minus_des(int layer) const { assert(layer>=0 && layerrms_sum2_minus_des(); } void print_data_header(ofstream& out) const; inline void print_data(ofstream& out) const { for (int l=0; lis_layer_hidden(l)) out << ' ' << Net->num_epochs() << " " << l << "\t " << *(QR[l]); } } inline void print_unit_usage(ostream &to, int epoch_number) { to << "Network: " << Net->name() << endl; to << "Epoch: " << epoch_number << endl; to << endl; for (int qr=0; qrprint_unit_usage(to); } } inline void print_Q_vs_Phat(ostream &to, int epoch_number) { for (int lay=0; layis_layer_hidden(lay)) QR[lay]->print_Q_vs_Phat(to); } } }; //CHANGE LOG: // 14 April 1998 Kevin Karplus // Added copy constructor // 15 April 1998 Kevin Karplus // Added q() // 25 July 1998 Kevin Karplus // Moved print_data_header() to NetQuality.cc so no longer inline // Added print_Q_vs_Phat // 24 May 2004 Kevin Karplus // inlined simple functions #endif