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

UCISpecification.cc

Go to the documentation of this file.
00001 // -*- C++ -*- 00002 00003 // UCISpecification.cc 00004 // 00005 // Copyright (C) 2004 Olivier Delalleau 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: UCISpecification.cc,v 1.3 2004/07/14 22:37:59 mariusmuja Exp $ 00037 ******************************************************* */ 00038 00039 // Authors: Olivier Delalleau 00040 00044 #include "UCISpecification.h" 00045 00046 namespace PLearn { 00047 using namespace std; 00048 00049 UCISpecification::UCISpecification() 00050 : header_exists(0), 00051 header_fields(0), 00052 file_all(""), 00053 file_test(""), 00054 file_train(""), 00055 format("UCI"), 00056 inputsize(-1), 00057 targetsize(-1), 00058 weightsize(-1), 00059 target_is_first(0) 00060 { 00061 } 00062 00063 PLEARN_IMPLEMENT_OBJECT(UCISpecification, 00064 "Describes the specifications of a UCI database.", 00065 "This object specifies characteristics of a database from the UCI machine\n" 00066 "learning repository, such as the input size, target size, etc...\n" 00067 "It is intended to be used in a script put in the same directory as the\n" 00068 "database, in order to be loaded by the getDataSet() method.\n" 00069 ); 00070 00071 void UCISpecification::declareOptions(OptionList& ol) 00072 { 00073 // ### Declare all of this object's options here 00074 // ### For the "flags" of each option, you should typically specify 00075 // ### one of OptionBase::buildoption, OptionBase::learntoption or 00076 // ### OptionBase::tuningoption. Another possible flag to be combined with 00077 // ### is OptionBase::nosave 00078 00079 declareOption(ol, "header_exists", &UCISpecification::header_exists, OptionBase::buildoption, 00080 "Specifies if there is a header for the dataset"); 00081 00082 declareOption(ol, "header_fields", &UCISpecification::header_fields, OptionBase::buildoption, 00083 "The fields that are present in the header"); 00084 00085 declareOption(ol, "file_all", &UCISpecification::file_all, OptionBase::buildoption, 00086 "The filename for the whole dataset"); 00087 00088 declareOption(ol, "file_train", &UCISpecification::file_train, OptionBase::buildoption, 00089 "The filename for the train data."); 00090 00091 declareOption(ol, "file_test", &UCISpecification::file_test, OptionBase::buildoption, 00092 "The filename for the test data."); 00093 00094 declareOption(ol, "format", &UCISpecification::format, OptionBase::buildoption, 00095 "The format of the dataset file."); 00096 00097 declareOption(ol, "inputsize", &UCISpecification::inputsize, OptionBase::buildoption, 00098 "Input size of the data"); 00099 00100 declareOption(ol, "targetsize", &UCISpecification::targetsize, OptionBase::buildoption, 00101 "Target size of the data"); 00102 00103 declareOption(ol, "weightsize", &UCISpecification::weightsize, OptionBase::buildoption, 00104 "Weight size of the data"); 00105 00106 declareOption(ol, "target_is_first", &UCISpecification::target_is_first, OptionBase::buildoption, 00107 "Whether the target is the first column (otherwise it is assumed to be the last one.."); 00108 00109 // Now call the parent class' declareOptions 00110 inherited::declareOptions(ol); 00111 } 00112 00113 void UCISpecification::build_() 00114 { 00115 // ### This method should do the real building of the object, 00116 // ### according to set 'options', in *any* situation. 00117 // ### Typical situations include: 00118 // ### - Initial building of an object from a few user-specified options 00119 // ### - Building of a "reloaded" object: i.e. from the complete set of all serialised options. 00120 // ### - Updating or "re-building" of an object after a few "tuning" options have been modified. 00121 // ### You should assume that the parent class' build_() has already been called. 00122 } 00123 00124 // ### Nothing to add here, simply calls build_ 00125 void UCISpecification::build() 00126 { 00127 inherited::build(); 00128 build_(); 00129 } 00130 00131 void UCISpecification::makeDeepCopyFromShallowCopy(map<const void*, void*>& copies) 00132 { 00133 inherited::makeDeepCopyFromShallowCopy(copies); 00134 00135 // ### Call deepCopyField on all "pointer-like" fields 00136 // ### that you wish to be deepCopied rather than 00137 // ### shallow-copied. 00138 // ### ex: 00139 // deepCopyField(trainvec, copies); 00140 00141 // ### Remove this line when you have fully implemented this method. 00142 PLERROR("UCISpecification::makeDeepCopyFromShallowCopy not fully (correctly) implemented yet!"); 00143 } 00144 00145 } // end of namespace PLearn

Generated on Tue Aug 17 16:09:20 2004 for PLearn by doxygen 1.3.7