// Globals.h // 1 Dec 1995 (moved out of EstCommand/Command.h) // Kevin Karplus // All "globals" of the program are static members of this type // (except the static members of other types!) #ifndef Globals_H #define Globals_H using namespace std; #include #include #include #include #include "NamedClass/NameToPtr.h" // Forward References class TrainSet; class InterfaceDescription; class NeuralNet; class NetActivation; class NetQuality; class OneChain; class BackgroundProbs; class AlphabetTuple; class GenSequence; class Globals { private: // The neural networks used for prediction or design static vector NNs; public: // static // add a neural net to the list if its input interface is // compatible with the existing networks. // Return 0 and don't add network static bool add_neural_net(NeuralNet *n); inline static int num_nns(void) { return NNs.size(); } static inline NeuralNet *nn(int i=-1) { if (i<0) i+=NNs.size(); if ( static_cast(NNs.size()) <=i) return NULL; return NNs[i]; } // Three sets of training data: // for training the neural network: training // for monitoring the progress of the training // and selecting between parameter sets: cross_training // for the final testing of the network: testing // and one set, without known correct answers: predicting static TrainSet *training, *cross_training, *testing, *predicting; // which of the three sets should new input data be added to? static TrainSet *which_set_to_add_to; // Added by Frellsen: // The chains used by design-1st static vector design_chains; static void clear_design_chains(void); // which columns of the design chain should be // copied from the provided "correct" answer. static vector FreezeTheseColumns; static void initialize_freeze(void); // which columns of the design chain must be // changed from the provided "correct" answer. static vector ChangeTheseColumns; static void initialize_change(void); // generator for random sequences, when they are needed. static GenSequence* SequenceGenerator; static ofstream* ReportSequenceWeightsTo; // where to report sequence weights after computing them // file to which NetQuality data will be recorded after each // training and cross-validation epoch static ofstream* ReportNetQualityForTrainTo; static ofstream* ReportNetQualityForCrossTrainTo; static ofstream* ReportNetQualityForTestTo; // file to which NetQuality data will be recorded after each // individual chain: static ofstream* ReportNetQualityForTrainChainTo; static ofstream* ReportNetQualityForCrossTrainChainTo; static ofstream* ReportNetQualityForTestChainTo; // file to which unit usage data is to be recorded static ofstream* ReportUnitUsageTo; // file to which QvsPhat plot is to be recorded static ofstream* ReportQvsPhatTo; // hash table for mapping alphabet names to // background probabilities static NameToPtr BackgroundProbsByName; static const BackgroundProbs* background_probs( const AlphabetTuple*al, OptionIfNew opt=ErrorIfNew); // Times at beginning of program---need to be initialized // with gettimeofday(&Globals::StartWallTime,0); // getrusage(RUSAGE_SELF, &resources) // at beginning of main() static struct timeval StartWallTime; static struct timeval StartCpuTime; // functions to compute the number of cpu seconds or wall-clock // seconds since the time stores in StartCpuTime and StartWallTime. static double user_seconds(void); static double elapsed_seconds(void); static void clear_all(void); // close all files and delete all data structures. }; // CHANGE LOG: // 21 July 1997 Kevin Karplus // copied from estimat-dist and removed everything related to // TestSet or regularizer stack. // 21 March 1998 Kevin Karplus // Added clear_all(). // 30 March 1998 kevin Karplus // Moved some "globals" into NeuralNet. // 2 May 1998 Kevin Karplus // Moved filename handling into Filenames/Filenames.h (and .cc) // 21 May 2004 Sol Katzman // Added time functions // Mon Jun 13 03:23:15 PDT 2005 Kevin Karplus // Picked up Jes Frellsen's addition of "design_chain" // Sat Jun 18 10:58:46 PDT 2005 Kevin Karplus // Added BackgroundProbsByName and background_probs() // Fri Jun 24 20:43:04 PDT 2005 Kevin Karplus // Replaced NN by vector NNs and made them private, with access // through nn() // Sun Jun 26 04:32:53 PDT 2005 Kevin Karplus // Added num_nns() // Sat Jul 9 04:36:31 PDT 2005 Kevin Karplus // Changed design_chain to design_chains // Added clear_design_chains // Thu Jul 14 22:02:13 PDT 2005 Kevin Karplus // added initialize_freeze and FreezeTheseColumns // Thu Jul 21 17:55:20 PDT 2005 Kevin Karplus // added SequenceGenerator // Sun Feb 5 02:41:02 PST 2006 Kevin Karplus // added ChangeTheseColumns #endif