PLearn 0.1
ARDBaseKernel.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // ARDBaseKernel.cc
00004 //
00005 // Copyright (C) 2006-2007 Nicolas Chapados
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 // Authors: Nicolas Chapados
00036 
00040 #include "ARDBaseKernel.h"
00041 
00042 namespace PLearn {
00043 using namespace std;
00044 
00045 PLEARN_IMPLEMENT_OBJECT(
00046     ARDBaseKernel,
00047     "Base class for kernels that carry out Automatic Relevance Determination (ARD)",
00048     "The purpose of this Kernel is to introduce utility options that are\n"
00049     "generally shared by Kernels that perform Automatic Relevance Determination\n"
00050     "(ARD).  It does not introduce any specific behavior related to those\n"
00051     "options (since exactly where the ARD hyperparameters are used is very\n"
00052     "kernel-specific, this is left to derived classes).\n"
00053     "\n"
00054     "Note that to make its operations more robust when used with unconstrained\n"
00055     "optimization of hyperparameters, all hyperparameters of this kernel are\n"
00056     "specified in the inverse softplus domain.  See IIDNoiseKernel for more\n"
00057     "explanations.\n"
00058     );
00059 
00060 ARDBaseKernel::ARDBaseKernel()
00061     : m_isp_signal_sigma(0.0),
00062       m_isp_global_sigma(0.0)
00063 { }
00064 
00065 
00066 //#####  declareOptions  ######################################################
00067 
00068 void ARDBaseKernel::declareOptions(OptionList& ol)
00069 {
00070     declareOption(
00071         ol, "isp_signal_sigma",
00072         &ARDBaseKernel::m_isp_signal_sigma,
00073         OptionBase::buildoption,
00074         "Inverse softplus of the global signal variance.  Default value=0.0");
00075 
00076     declareOption(
00077         ol, "isp_global_sigma",
00078         &ARDBaseKernel::m_isp_global_sigma,
00079         OptionBase::buildoption,
00080         "Inverse softplus of the global length-scale.  Note that if ARD is\n"
00081         "performed on input-specific sigmas, this hyperparameter should have a\n"
00082         "fixed value (and not be varied during the optimization).  Default\n"
00083         "value=0.0.\n");
00084 
00085     declareOption(
00086         ol, "isp_input_sigma",
00087         &ARDBaseKernel::m_isp_input_sigma,
00088         OptionBase::buildoption,
00089         "If specified, contain input-specific length-scales that can be\n"
00090         "individually optimized for (these are the ARD hyperparameters).\n");
00091 
00092     // Now call the parent class' declareOptions
00093     inherited::declareOptions(ol);
00094 }
00095 
00096 
00097 void ARDBaseKernel::build()
00098 {
00099     // ### Nothing to add here, simply calls build_
00100     inherited::build();
00101     build_();
00102 }
00103 
00104 
00105 void ARDBaseKernel::build_()
00106 { }
00107 
00108 
00109 void ARDBaseKernel::makeDeepCopyFromShallowCopy(CopiesMap& copies)
00110 {
00111     inherited::makeDeepCopyFromShallowCopy(copies);
00112 
00113     deepCopyField(m_isp_input_sigma, copies);
00114     deepCopyField(m_input_sigma,     copies);
00115 }
00116 
00117 } // end of namespace PLearn
00118 
00119 
00120 /*
00121   Local Variables:
00122   mode:c++
00123   c-basic-offset:4
00124   c-file-style:"stroustrup"
00125   c-file-offsets:((innamespace . 0)(inline-open . 0))
00126   indent-tabs-mode:nil
00127   fill-column:79
00128   End:
00129 */
00130 // 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