Scheduler.h

00001 #ifndef __SCHEDULER_
00002 #define __SCHEDULER_
00003 
00004 #include "Data.h"
00005 #include "BlendStopping.h"
00006 #include "Algorithm.h"
00007 #include "LinearModel.h"
00008 #include "KNearestNeighbor.h"
00009 #include "NeuralNetwork.h"
00010 #include "NeuralNetworkRBMauto.h"
00011 #include "PolynomialRegression.h"
00012 #include "LinearModelNonNeg.h"
00013 #include "Framework.h"
00014 #include "BlendingNN.h"
00015 #include "DatasetReader.h"
00016 #include "KernelRidgeRegression.h"
00017 #include "Autoencoder.h"
00018 #include "GBDT.h"
00019 #include "LogisticRegression.h"
00020 
00021 #include <math.h>
00022 #include <stdio.h>
00023 #include <stdlib.h>
00024 #include <sstream>
00025 
00026 using namespace std;
00027 
00041 class Scheduler : public Framework
00042 {
00043 public:
00044     Scheduler();
00045     ~Scheduler();
00046 
00047     void readMasterDscFile ( string path, string masterName );
00048     void train();
00049     void predict();
00050     void blend();
00051     void bagging();
00052     void boosting();
00053 
00054     REAL getPredictionRMSE();
00055     REAL getClassificationError();
00056 
00057     static string masterDscTemplateGenerator ( string dataset, bool isClass, vector<string> algos, int rSeed, string blendAlgo, bool cascade );
00058 
00059 private:
00060     void trainAlgorithm ( string fnameTemplate, string fnameDsc );
00061     void checkAlgorithmTemplate ( string fname, string &algoName, string &id );
00062     void setPredictionModeInAlgorithm ( string fname );
00063     int getIDFromFullPredictor ( string fullPredictor );
00064     void algorithmDispatcher ( Algorithm* &algo, string name );
00065     void getEnsemblePrediction ( REAL* input, REAL* output );
00066     void preparePredictionMode();
00067     int getIndexOfMax ( REAL* vector, int length );
00068     void endPredictionMode();
00069 
00070     vector<string> m_algorithmList;
00071     vector<int> m_algorithmIDList;
00072     vector<string> m_algorithmNameList;
00073     Data* m_data;  // base data object
00074     vector<Algorithm*> m_algorithmObjectList;
00075     vector<Algorithm**> m_algorithmObjectListList;  // this is for: validationType=CrossFoldMean|Bagging
00076 
00077     // prediction mode
00078     BlendStopping* m_blender;
00079     BlendingNN* m_blenderNN;
00080     int* m_labelsPredict;
00081     int* m_effectID;
00082     REAL* m_noEffect;
00083     REAL** m_outputs;
00084     REAL** m_effects;
00085     REAL m_predictionRMSE;
00086     REAL m_predictionClassificationError;
00087     REAL* m_outputVectorTmp;
00088     int* m_labelsTmp;
00089 
00090     // bagging / boosting
00091     bool m_baggingRun;
00092     bool m_boostingRun;
00093     uint m_randSeedBagBoost;
00094     REAL* m_probs;
00095     REAL* m_boostingTrain;
00096     REAL* m_boostingTargets;
00097     int m_boostingNTrain;
00098     int m_boostingEpoch;
00099 };
00100 
00101 
00102 #endif

Generated on Tue Jan 26 09:20:59 2010 for ELF by  doxygen 1.5.8