PLearn 0.1
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Private Types | Private Member Functions
PLearn::PolynomialKernel Class Reference

#include <PolynomialKernel.h>

Inheritance diagram for PLearn::PolynomialKernel:
Inheritance graph
[legend]
Collaboration diagram for PLearn::PolynomialKernel:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PolynomialKernel ()
 Default constructor.
 PolynomialKernel (int the_n, real the_beta=1.0, bool call_build_=true)
 Convenient constructor.
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual PolynomialKerneldeepCopy (CopiesMap &copies) const
virtual real evaluate (const Vec &x1, const Vec &x2) const
 ** Subclasses must override this method **
virtual real evaluate_i_j (int i, int j) const
 returns evaluate(data(i),data(j))
virtual real evaluate_i_x (int i, const Vec &x, real squared_norm_of_x=-1) const
 Return evaluate(data(i),x).
virtual real evaluate_x_i (const Vec &x, int i, real squared_norm_of_x=-1) const
 returns evaluate(x,data(i)) [default version calls evaluate_i_x if kernel is_symmetric]
virtual void build ()
 Post-constructor.
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Transforms a shallow copy into a deep copy.

Static Public Member Functions

static string _classname_ ()
static OptionList_getOptionList_ ()
static RemoteMethodMap_getRemoteMethodMap_ ()
static Object_new_instance_for_typemap_ ()
static bool _isa_ (const Object *o)
static void _static_initialize_ ()
static const PPathdeclaringFile ()

Public Attributes

int n
real beta

Static Public Attributes

static StaticInitializer _static_initializer_

Protected Member Functions

real evaluateFromDot (real dot_product) const
 Evaluate kernel value from the value of the dot product.

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declares the class options.

Private Types

typedef Kernel inherited

Private Member Functions

void build_ ()
 This does the actual building.

Detailed Description

Definition at line 51 of file PolynomialKernel.h.


Member Typedef Documentation

Reimplemented from PLearn::Kernel.

Definition at line 53 of file PolynomialKernel.h.


Constructor & Destructor Documentation

PLearn::PolynomialKernel::PolynomialKernel ( )

Default constructor.

Definition at line 58 of file PolynomialKernel.cc.

                                  :
    n(2),
    beta(1)
{}
PLearn::PolynomialKernel::PolynomialKernel ( int  the_n,
real  the_beta = 1.0,
bool  call_build_ = true 
)

Convenient constructor.

Definition at line 63 of file PolynomialKernel.cc.

References build_().

                                                    :
    inherited(true, call_build_),
    n(degree),
    beta(the_beta)
{
    if (call_build_)
        build_();
}

Here is the call graph for this function:


Member Function Documentation

string PLearn::PolynomialKernel::_classname_ ( ) [static]

Reimplemented from PLearn::Kernel.

Definition at line 53 of file PolynomialKernel.cc.

OptionList & PLearn::PolynomialKernel::_getOptionList_ ( ) [static]

Reimplemented from PLearn::Kernel.

Definition at line 53 of file PolynomialKernel.cc.

RemoteMethodMap & PLearn::PolynomialKernel::_getRemoteMethodMap_ ( ) [static]

Reimplemented from PLearn::Kernel.

Definition at line 53 of file PolynomialKernel.cc.

bool PLearn::PolynomialKernel::_isa_ ( const Object o) [static]

Reimplemented from PLearn::Kernel.

Definition at line 53 of file PolynomialKernel.cc.

Object * PLearn::PolynomialKernel::_new_instance_for_typemap_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 53 of file PolynomialKernel.cc.

StaticInitializer PolynomialKernel::_static_initializer_ & PLearn::PolynomialKernel::_static_initialize_ ( ) [static]

Reimplemented from PLearn::Kernel.

Definition at line 53 of file PolynomialKernel.cc.

void PLearn::PolynomialKernel::build ( ) [virtual]

Post-constructor.

The normal implementation should call simply inherited::build(), then this class's build_(). This method should be callable again at later times, after modifying some option fields to change the "architecture" of the object.

Reimplemented from PLearn::Kernel.

Definition at line 92 of file PolynomialKernel.cc.

References PLearn::Kernel::build(), and build_().

Here is the call graph for this function:

void PLearn::PolynomialKernel::build_ ( ) [private]

This does the actual building.

Reimplemented from PLearn::Kernel.

Definition at line 101 of file PolynomialKernel.cc.

References beta, n, and PLASSERT.

Referenced by build(), and PolynomialKernel().

{
    PLASSERT(n >= 1 && beta > 0);
}

Here is the caller graph for this function:

string PLearn::PolynomialKernel::classname ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 53 of file PolynomialKernel.cc.

void PLearn::PolynomialKernel::declareOptions ( OptionList ol) [static, protected]

Declares the class options.

Reimplemented from PLearn::Kernel.

Definition at line 76 of file PolynomialKernel.cc.

References beta, PLearn::OptionBase::buildoption, PLearn::declareOption(), PLearn::Kernel::declareOptions(), and n.

{
    declareOption(ol, "n", &PolynomialKernel::n, OptionBase::buildoption,
                  "Degree of the kernel.");

    declareOption(ol, "beta", &PolynomialKernel::beta, OptionBase::buildoption,
                  "Scaling coefficient for the dot product.");

    // Declare options inherited from parent class.
    inherited::declareOptions(ol);
}

Here is the call graph for this function:

static const PPath& PLearn::PolynomialKernel::declaringFile ( ) [inline, static]

Reimplemented from PLearn::Kernel.

Definition at line 68 of file PolynomialKernel.h.

:

PolynomialKernel * PLearn::PolynomialKernel::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::Kernel.

Definition at line 53 of file PolynomialKernel.cc.

real PLearn::PolynomialKernel::evaluate ( const Vec x1,
const Vec x2 
) const [virtual]

** Subclasses must override this method **

returns K(x1,x2)

Implements PLearn::Kernel.

Definition at line 109 of file PolynomialKernel.cc.

References PLearn::dot(), and evaluateFromDot().

{ return evaluateFromDot(dot(x1,x2)); }

Here is the call graph for this function:

real PLearn::PolynomialKernel::evaluate_i_j ( int  i,
int  j 
) const [virtual]

returns evaluate(data(i),data(j))

Reimplemented from PLearn::Kernel.

Definition at line 115 of file PolynomialKernel.cc.

References PLearn::Kernel::data, and evaluateFromDot().

{ return evaluateFromDot(data->dot(i,j)); }

Here is the call graph for this function:

real PLearn::PolynomialKernel::evaluate_i_x ( int  i,
const Vec x,
real  squared_norm_of_x = -1 
) const [virtual]

Return evaluate(data(i),x).

[squared_norm_of_x is just a hint that may allow to speed up computation if it is already known, but it's optional]

Reimplemented from PLearn::Kernel.

Definition at line 121 of file PolynomialKernel.cc.

References PLearn::Kernel::data, and evaluateFromDot().

{ return evaluateFromDot(data->dot(i,x)); } 

Here is the call graph for this function:

real PLearn::PolynomialKernel::evaluate_x_i ( const Vec x,
int  i,
real  squared_norm_of_x = -1 
) const [virtual]

returns evaluate(x,data(i)) [default version calls evaluate_i_x if kernel is_symmetric]

Reimplemented from PLearn::Kernel.

Definition at line 127 of file PolynomialKernel.cc.

References PLearn::Kernel::data, and evaluateFromDot().

{ return evaluateFromDot(data->dot(i,x)); } 

Here is the call graph for this function:

real PLearn::PolynomialKernel::evaluateFromDot ( real  dot_product) const [inline, protected]

Evaluate kernel value from the value of the dot product.

Definition at line 88 of file PolynomialKernel.h.

References PLearn::ipow(), and n.

Referenced by evaluate(), evaluate_i_j(), evaluate_i_x(), and evaluate_x_i().

    {
        return ipow(beta*dot_product + real(1.0), n);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

OptionList & PLearn::PolynomialKernel::getOptionList ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 53 of file PolynomialKernel.cc.

OptionMap & PLearn::PolynomialKernel::getOptionMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 53 of file PolynomialKernel.cc.

RemoteMethodMap & PLearn::PolynomialKernel::getRemoteMethodMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 53 of file PolynomialKernel.cc.

void PLearn::PolynomialKernel::makeDeepCopyFromShallowCopy ( CopiesMap copies) [virtual]

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::Kernel.

Definition at line 133 of file PolynomialKernel.cc.

References PLearn::Kernel::makeDeepCopyFromShallowCopy().

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::Kernel.

Definition at line 68 of file PolynomialKernel.h.

Definition at line 58 of file PolynomialKernel.h.

Referenced by build_(), and declareOptions().

Definition at line 57 of file PolynomialKernel.h.

Referenced by build_(), and declareOptions().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines