PLearn 0.1
UnconditionalDistribution.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // UnconditionalDistribution.cc
00004 //
00005 // Copyright (C) 2004-2006 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: UnconditionalDistribution.cc 8544 2008-02-20 19:54:56Z tihocan $
00037  ******************************************************* */
00038 
00039 // Authors: Olivier Delalleau
00040 
00044 #include "UnconditionalDistribution.h"
00045 
00046 namespace PLearn {
00047 using namespace std;
00048 
00050 // UnconditionalDistribution //
00052 UnconditionalDistribution::UnconditionalDistribution()
00053 {
00054     predictor_size = 0;
00055     predicted_size = -1;
00056 }
00057 
00058 PLEARN_IMPLEMENT_OBJECT(UnconditionalDistribution,
00059     "A simplified version of PDistribution for unconditional distributions.",
00060 
00061     "The only goal of this class is to hide the conditional side of\n"
00062     "PDistributions to make unconditional distributions simpler."
00063 );
00064 
00066 // declareOptions //
00068 void UnconditionalDistribution::declareOptions(OptionList& ol)
00069 {
00070     // First call the parent class' declareOptions().
00071     inherited::declareOptions(ol);
00072 
00073     // And modify some options for unconditional distributions.
00074 
00075     redeclareOption(ol, "outputs_def", &UnconditionalDistribution::outputs_def,
00076                                        OptionBase::buildoption,
00077         "See help for this option in PDistribution. Basically, this is the\n"
00078         "same, except that 'E' and 'V' are obviously not allowed.");
00079     // TODO Find a cool way to synchronize this help with the PDistribution
00080     // help?
00081 
00082     redeclareOption(ol, "predictor_size",
00083                         &UnconditionalDistribution::predictor_size,
00084                         OptionBase::nosave,
00085         "Unused in unconditional distributions.");
00086 
00087     redeclareOption(ol, "predicted_size",
00088                         &UnconditionalDistribution::predicted_size,
00089                         OptionBase::nosave,
00090         "Unused in unconditional distributions.");
00091 
00092     redeclareOption(ol, "predictor_part",
00093                         &UnconditionalDistribution::predictor_part,
00094                         OptionBase::nosave,
00095         "Unused in unconditional distributions.");
00096 
00097     redeclareOption(ol, "n_predictor",
00098                         &UnconditionalDistribution::n_predictor,
00099                         OptionBase::nosave,
00100         "Unused in unconditional distributions.");
00101 }
00102 
00104 // build //
00106 void UnconditionalDistribution::build()
00107 {
00108     inherited::build();
00109     build_();
00110 }
00111 
00113 // build_ //
00115 void UnconditionalDistribution::build_()
00116 {
00117 }
00118 
00120 // forget //
00122 void UnconditionalDistribution::forget() {
00123     inherited::forget();
00124     n_predictor = 0;
00125 }
00126 
00128 // makeDeepCopyFromShallowCopy //
00130 void UnconditionalDistribution::makeDeepCopyFromShallowCopy(CopiesMap& copies)
00131 {
00132     inherited::makeDeepCopyFromShallowCopy(copies);
00133 }
00134 
00136 // setPredictor //
00138 void UnconditionalDistribution::setPredictor(const Vec& predictor,
00139                                              bool call_parent) const
00140 {
00141     PLERROR("In UnconditionalDistribution::setPredictor -\n"
00142             "Not implemented for unconditional distributions.\n");
00143 }
00144 
00146 // generatePredictor //
00148 void UnconditionalDistribution::generatePredictor(Vec& x)
00149 {
00150     PLERROR("In UnconditionalDistribution::generatePredictor -\n"
00151             "Not implemented for unconditional distributions.\n");
00152 }
00153 
00155 // generatePredictorGivenPredicted //
00157 void UnconditionalDistribution::generatePredictorGivenPredicted(Vec& x,
00158                                                                 const Vec& y)
00159 {
00160     PLERROR("In UnconditionalDistribution::generatePredictorGivenPredicted -\n"
00161             "Not implemented for unconditional distributions.\n");
00162 }
00163 
00165 // generateJoint //
00167 void UnconditionalDistribution::generateJoint(Vec& xy)
00168 {
00169     PLWARNING("In UnconditionalDistribution::generateJoint -\n"
00170               "Not implemented for unconditional distributions.\n"
00171               "Calling \"generate\" instead.\n");
00172     generate(xy);
00173 }
00174 
00176 // generatePredicted //
00178 void UnconditionalDistribution::generatePredicted(Vec& y)
00179 {
00180     PLERROR("In UnconditionalDistribution::generatePredicted -\n"
00181             "Not implemented for unconditional distributions.\n"
00182             "Calling \"generate\" instead.\n");
00183     generate(y);
00184 }
00185 
00186 
00187 
00188 } // end of namespace PLearn
00189 
00190 
00191 /*
00192   Local Variables:
00193   mode:c++
00194   c-basic-offset:4
00195   c-file-style:"stroustrup"
00196   c-file-offsets:((innamespace . 0)(inline-open . 0))
00197   indent-tabs-mode:nil
00198   fill-column:79
00199   End:
00200 */
00201 // 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