Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PTester.h

Go to the documentation of this file.
00001 // -*- C++ -*- 00002 00003 // PTester.h 00004 // 00005 // Copyright (C) 2002 Pascal Vincent, Frederic Morin 00006 // 00007 // Redistribution and use in source and binary forms, with or without 00008 // modification, are permitted provided that the following conditions are met: 00009 // 00010 // 1. Redistributions of source code must retain the above copyright 00011 // notice, this list of conditions and the following disclaimer. 00012 // 00013 // 2. Redistributions in binary form must reproduce the above copyright 00014 // notice, this list of conditions and the following disclaimer in the 00015 // documentation and/or other materials provided with the distribution. 00016 // 00017 // 3. The name of the authors may not be used to endorse or promote 00018 // products derived from this software without specific prior written 00019 // permission. 00020 // 00021 // THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 00022 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00023 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 00024 // NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00025 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 00026 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00027 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00028 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00029 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00030 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 // 00032 // This file is part of the PLearn library. For more information on the PLearn 00033 // library, go to the PLearn Web site at www.plearn.org 00034 00035 /* ******************************************************* 00036 * $Id: PTester.h,v 1.15 2004/07/26 20:13:52 tihocan Exp $ 00037 ******************************************************* */ 00038 00040 #ifndef PTester_INC 00041 #define PTester_INC 00042 00043 #include <plearn/base/Object.h> 00044 #include <plearn/vmat/Splitter.h> 00045 #include <plearn/vmat/VMat.h> 00046 #include <plearn_learners/generic/PLearner.h> 00047 00048 namespace PLearn { 00049 using namespace std; 00050 00051 class PTester: public Object 00052 { 00053 00054 private: 00055 00056 typedef Object inherited; 00057 00058 protected: 00059 00062 TVec<string> statnames_processed; 00063 00064 public: 00065 00066 // ************************ 00067 // * public build options * 00068 // ************************ 00069 00070 // See declareOptions method in .cc for the role of these options. 00071 00073 VMat dataset; 00074 string expdir; 00075 TVec<string> final_commands; 00076 PP<VecStatsCollector> global_template_stats_collector; 00077 PP<PLearner> learner; 00078 bool provide_learner_expdir; 00079 bool report_stats; 00080 bool save_data_sets; 00081 bool save_initial_learners; 00082 bool save_initial_tester; 00083 bool save_learners; 00084 bool save_stat_collectors; 00085 bool save_test_costs; 00086 bool save_test_outputs; 00087 PP<Splitter> splitter; 00088 TVec<TVec<string> > statmask; 00089 PP<VecStatsCollector> template_stats_collector; 00090 bool train; // whether or not to train or just test 00091 00092 // TODO Move to protected as soon as Apstat code is fixed. 00093 // Protected because it is safer to access it from getStatNames, 00094 // since the 'statmask' option may modify the stats. 00095 TVec<string> statnames; 00096 00097 // **************** 00098 // * Constructors * 00099 // **************** 00100 00101 // Default constructor 00102 PTester(); 00103 00104 00105 // ****************** 00106 // * Object methods * 00107 // ****************** 00108 00109 private: 00111 // (Please implement in .cc) 00112 void build_(); 00113 00114 protected: 00116 // (Please implement in .cc) 00117 static void declareOptions(OptionList& ol); 00118 00119 public: 00120 // simply calls inherited::build() then build_() 00121 virtual void build(); 00122 00124 PLEARN_DECLARE_OBJECT(PTester); 00125 00130 void setExperimentDirectory(const string& the_expdir); 00131 00133 string getExperimentDirectory() const { return expdir; } 00134 00135 00137 TVec<string> getStatNames(); 00138 00140 virtual void run(); 00141 00152 Vec perform(bool call_forget=true); 00153 00155 virtual void makeDeepCopyFromShallowCopy(map<const void*, void*>& copies); 00156 00157 }; 00158 00159 DECLARE_OBJECT_PTR(PTester); 00160 00161 00163 00164 class StatSpec 00165 { 00166 public: 00167 string extstat; 00168 string setname; 00169 int setnum; 00170 00173 string intstatname; 00174 00175 StatSpec() : setnum(-1) {} 00176 00177 void init(const string& statname); 00178 00179 string statName() 00180 { return extstat + "[" + setname + "." + intstatname + "]"; } 00181 00182 private: 00183 00185 void parseStatname(const string& statname); 00186 }; 00187 00188 } // end of namespace PLearn 00189 00190 #endif

Generated on Tue Aug 17 16:03:19 2004 for PLearn by doxygen 1.3.7