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

EmpiricalDistribution.h

Go to the documentation of this file.
00001 // PLearn (A C++ Machine Learning Library) 00002 // Copyright (C) 2002 Pascal Vincent 00003 // 00004 // Redistribution and use in source and binary forms, with or without 00005 // modification, are permitted provided that the following conditions are met: 00006 // 00007 // 1. Redistributions of source code must retain the above copyright 00008 // notice, this list of conditions and the following disclaimer. 00009 // 00010 // 2. 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 // 00014 // 3. The name of the authors may not be used to endorse or promote 00015 // products derived from this software without specific prior written 00016 // permission. 00017 // 00018 // THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR 00019 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00020 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 00021 // NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00022 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 00023 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00024 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00025 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00026 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00027 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00028 // 00029 // This file is part of the PLearn library. For more information on the PLearn 00030 // library, go to the PLearn Web site at www.plearn.org 00031 00032 00033 #ifndef EmpiricalDistribution_INC 00034 #define EmpiricalDistribution_INC 00035 00036 #include "Distribution.h" 00037 00038 namespace PLearn { 00039 using namespace std; 00040 00041 00042 class EmpiricalDistribution: public Distribution 00043 { 00044 protected: 00045 00046 VMat data; 00047 00048 typedef Distribution inherited; 00049 00050 public: 00051 00052 EmpiricalDistribution(); 00053 00054 EmpiricalDistribution(int inputsize, bool random_sample_ = true); 00055 00056 PLEARN_DECLARE_OBJECT(EmpiricalDistribution); 00057 void makeDeepCopyFromShallowCopy(CopiesMap& copies); 00058 00059 virtual void train(VMat training_set); 00060 00061 00062 00063 //Should return log of probability density log(p(x)) 00064 //Not implemented for this distribution 00065 virtual double log_density(const Vec& x) const; 00066 00068 virtual double survival_fn(const Vec& x) const; 00069 00071 virtual double cdf(const Vec& x) const; 00072 00074 virtual Vec expectation() const; 00075 00077 virtual Mat variance() const; 00078 00079 00080 00082 virtual void generate(Vec& x) const; 00083 00084 //If true, generate return a random example. If false, 00085 //generate return the next example in the training_set. 00086 bool random_sample; 00087 00088 //The length of the current training set 00089 int length; 00090 00091 //The example to be returned by generate 00092 mutable int current_sample_x; 00093 mutable int current_sample_y; 00094 mutable bool flip; 00095 00096 protected: 00097 static void declareOptions(OptionList& ol); 00098 00099 }; 00100 00101 DECLARE_OBJECT_PTR(EmpiricalDistribution); 00102 00103 } // end of namespace PLearn 00104 00105 #endif

Generated on Tue Aug 17 15:52:12 2004 for PLearn by doxygen 1.3.7