PLearn 0.1
ScaledConditionalCDFSmoother.h
Go to the documentation of this file.
00001 
00002 
00003 // -*- C++ -*-
00004 
00005 // ScaledConditionalCDFSmoother.h
00006 // 
00007 // Copyright (C) *YEAR* *AUTHOR(S)* 
00008 // ...
00009 // Copyright (C) *YEAR* *AUTHOR(S)* 
00010 // 
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are met:
00013 // 
00014 //  1. Redistributions of source code must retain the above copyright
00015 //     notice, this list of conditions and the following disclaimer.
00016 // 
00017 //  2. Redistributions in binary form must reproduce the above copyright
00018 //     notice, this list of conditions and the following disclaimer in the
00019 //     documentation and/or other materials provided with the distribution.
00020 // 
00021 //  3. The name of the authors may not be used to endorse or promote
00022 //     products derived from this software without specific prior written
00023 //     permission.
00024 // 
00025 // THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
00026 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00027 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
00028 // NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00029 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00030 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00031 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00032 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00033 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00034 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00035 // 
00036 // This file is part of the PLearn library. For more information on the PLearn
00037 // library, go to the PLearn Web site at www.plearn.org
00038 
00039 /* *******************************************************      
00040  * $Id: ScaledConditionalCDFSmoother.h 3994 2005-08-25 13:35:03Z chapados $ 
00041  ******************************************************* */
00042 
00044 #ifndef ScaledConditionalCDFSmoother_INC
00045 #define ScaledConditionalCDFSmoother_INC
00046 
00047 #include "ConditionalCDFSmoother.h"
00048 
00049 namespace PLearn {
00050 using namespace std;
00051 
00052 class ScaledConditionalCDFSmoother: public ConditionalCDFSmoother
00053 {
00054 protected:
00055     // *********************
00056     // * protected options *
00057     // *********************
00058 
00059     // ### declare protected option fields (such as learnt parameters) here
00060     // ...
00061     
00062 public:
00063 
00064     typedef ConditionalCDFSmoother inherited;
00065 
00066     // ************************
00067     // * public build options *
00068     // ************************
00069 
00070     // ### declare public option fields (such as build options) here
00071 
00072     // selects which formula is used to interpolate the survival
00073     // function inside each of the large intervals.
00074     bool preserve_relative_density;
00075 
00076     // ****************
00077     // * Constructors *
00078     // ****************
00079 
00080     // Default constructor, make sure the implementation in the .cc
00081     // initializes all fields to reasonable default values.
00082     ScaledConditionalCDFSmoother();
00083 
00084     // ******************
00085     // * Object methods *
00086     // ******************
00087 
00088 private: 
00090     // (Please implement in .cc)
00091     void build_();
00092 
00093 protected: 
00095     // (Please implement in .cc)
00096     static void declareOptions(OptionList& ol);
00097 
00098 public:
00099     // simply calls inherited::build() then build_() 
00100     virtual void build();
00101 
00103     virtual void makeDeepCopyFromShallowCopy(CopiesMap& copies);
00104 
00106     PLEARN_DECLARE_OBJECT(ScaledConditionalCDFSmoother);
00107 
00108 
00109     /****
00110      * ScaledConditionalCDFSmoother methods
00111      */
00112 
00113 public:
00114     // The source function is either f(i) = source_function[i] as a function of i
00115     // or if bin_positions is provided (non-zero length), 
00116     //    f(x) = source_function[i]
00117     //      where i is s.t. bin_positions[i]>x>=bin_positions[i+1]
00118     // the optional bin_positions vector has length 0, or 1 more than source_function.
00119     // By default (if not provided) the dest_bin_positions are assumed the same as the source bin_positions.
00120     // Returns integral(smoothed_function).
00121     virtual real smooth(const Vec& source_function, Vec& smoothed_function, 
00122                         Vec bin_positions = Vec(), Vec dest_bin_positions = Vec()) const;
00123 
00124     //   real smooth(const HistogramCDF& source_cdf, HistogramCDF& dest_cdf);
00125 
00126 };
00127 
00128 // Declares a few other classes and functions related to this class
00129 DECLARE_OBJECT_PTR(ScaledConditionalCDFSmoother);
00130   
00131 } // end of namespace PLearn
00132 
00133 #endif
00134 
00135 
00136 /*
00137   Local Variables:
00138   mode:c++
00139   c-basic-offset:4
00140   c-file-style:"stroustrup"
00141   c-file-offsets:((innamespace . 0)(inline-open . 0))
00142   indent-tabs-mode:nil
00143   fill-column:79
00144   End:
00145 */
00146 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=79 :
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines