PLearn 0.1
|
00001 // -*- C++ -*- 00002 00003 // PLearn (A C++ Machine Learning Library) 00004 // Copyright (C) 2003-2005 Olivier Delalleau 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 // 00009 // 1. Redistributions of source code must retain the above copyright 00010 // notice, this list of conditions and the following disclaimer. 00011 // 00012 // 2. Redistributions in binary form must reproduce the above copyright 00013 // notice, this list of conditions and the following disclaimer in the 00014 // documentation and/or other materials provided with the distribution. 00015 // 00016 // 3. The name of the authors may not be used to endorse or promote 00017 // products derived from this software without specific prior written 00018 // permission. 00019 // 00020 // THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 00021 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00022 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 00023 // NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00024 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 00025 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00026 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00027 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00028 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00029 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00030 // 00031 // This file is part of the PLearn library. For more information on the PLearn 00032 // library, go to the PLearn Web site at www.plearn.org 00033 00034 00035 /* ******************************************************* 00036 * $Id: BootstrapVMatrix.h 8370 2007-12-28 20:51:40Z tihocan $ 00037 ******************************************************* */ 00038 00039 00042 #ifndef BootstrapVMatrix_INC 00043 #define BootstrapVMatrix_INC 00044 00045 #include "SelectRowsVMatrix.h" 00046 #include <plearn/math/PRandom.h> 00047 00048 namespace PLearn { 00049 using namespace std; 00050 00051 class BootstrapVMatrix: public SelectRowsVMatrix 00052 { 00053 typedef SelectRowsVMatrix inherited; 00054 00055 public: 00056 00058 00060 PP<PRandom> rgen; 00061 00062 real frac; 00063 int n_elems; 00064 bool operate_on_bags; 00065 int32_t own_seed; 00066 int32_t seed; 00067 bool shuffle; 00068 bool allow_repetitions; 00069 00070 public: 00071 00073 BootstrapVMatrix(); 00074 00076 BootstrapVMatrix(VMat m, real frac, bool shuffle = false, 00077 int32_t the_seed = 1827, 00078 bool allow_rep= false); 00079 00081 BootstrapVMatrix(VMat m, real frac, PP<PRandom> the_rgen, 00082 bool shuffle = false, 00083 bool allow_rep= false); 00084 00085 PLEARN_DECLARE_OBJECT(BootstrapVMatrix); 00086 00087 virtual void build(); 00088 00090 virtual void makeDeepCopyFromShallowCopy(CopiesMap& copies); 00091 00092 protected: 00093 00094 static void declareOptions(OptionList &ol); 00095 00096 private: 00097 00098 void build_(); 00099 00100 }; 00101 00102 DECLARE_OBJECT_PTR(BootstrapVMatrix); 00103 00104 } // end of namespace PLearn 00105 #endif 00106 00107 00108 /* 00109 Local Variables: 00110 mode:c++ 00111 c-basic-offset:4 00112 c-file-style:"stroustrup" 00113 c-file-offsets:((innamespace . 0)(inline-open . 0)) 00114 indent-tabs-mode:nil 00115 fill-column:79 00116 End: 00117 */ 00118 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=79 :