libeblearntools
|
00001 /*************************************************************************** 00002 * Copyright (C) 2011 by Pierre Sermanet * 00003 * pierre.sermanet@gmail.com * 00004 * All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions are met: 00008 * * Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above copyright 00011 * notice, this list of conditions and the following disclaimer in the 00012 * documentation and/or other materials provided with the distribution. 00013 * * Redistribution under a license not approved by the Open Source 00014 * Initiative (http://www.opensource.org) must display the 00015 * following acknowledgement in all advertising material: 00016 * This product includes software developed at the Courant 00017 * Institute of Mathematical Sciences (http://cims.nyu.edu). 00018 * * The names of the authors may not be used to endorse or promote products 00019 * derived from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 00022 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00023 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00024 * DISCLAIMED. IN NO EVENT SHALL ThE AUTHORS BE LIABLE FOR ANY 00025 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00026 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00027 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00028 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 * (INCLUDING 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 00033 #ifndef TRAIN_UTILS_H_ 00034 #define TRAIN_UTILS_H_ 00035 00036 #include <list> 00037 #include <string> 00038 #include <vector> 00039 #include <map> 00040 #include <iostream> 00041 #include <iomanip> 00042 00043 #include "defines.h" 00044 #include "idx.h" 00045 #include "job.h" 00046 #include "ebl_states.h" 00047 #include "ebl_trainer.h" 00048 00049 #ifdef __GUI__ 00050 #include "ebl_trainer_gui.h" 00051 #endif 00052 00053 using namespace std; 00054 00055 namespace ebl { 00056 00058 // training utilities 00059 00063 template <typename Tnet, typename Tdata, typename Tlabel> 00064 void test_and_save(uint iter, configuration &conf, string &conffname, 00065 parameter<Tnet> &theparam, 00066 supervised_trainer<Tnet,Tdata,Tlabel> &thetrainer, 00067 labeled_datasource<Tnet,Tdata,Tlabel> &train_ds, 00068 labeled_datasource<Tnet,Tdata,Tlabel> &test_ds, 00069 classifier_meter &trainmeter, 00070 classifier_meter &testmeter, 00071 infer_param &infp, gd_param &gdp, string &shortname, 00072 long iteration_seconds = 0); 00073 00075 template <typename Tnet, typename Tdata, typename Tlabel> 00076 void test(uint iter, configuration &conf, string &conffname, 00077 parameter<Tnet> &theparam, 00078 supervised_trainer<Tnet,Tdata,Tlabel> &thetrainer, 00079 labeled_datasource<Tnet,Tdata,Tlabel> &train_ds, 00080 labeled_datasource<Tnet,Tdata,Tlabel> &test_ds, 00081 classifier_meter &trainmeter, 00082 classifier_meter &testmeter, 00083 infer_param &infp, gd_param &gdp, string &shortname); 00084 00089 template <typename Tnet, typename Tdata, typename Tlabel> 00090 labeled_datasource<Tnet,Tdata,Tlabel>* 00091 create_validation_set(configuration &conf, uint &noutputs, string &name); 00092 00097 template <typename Tnet, typename Tdata, typename Tlabel> 00098 labeled_datasource<Tnet,Tdata,Tlabel>* 00099 create_training_set(configuration &conf, uint &noutputs, string &name); 00100 00101 } // end namespace ebl 00102 00103 #include "train_utils.hpp" 00104 00105 #endif /* TRAIN_UTILS_ */