PLearn 0.1
|
#include <PolynomialKernel.h>
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 OptionList & | getOptionList () const |
virtual OptionMap & | getOptionMap () const |
virtual RemoteMethodMap & | getRemoteMethodMap () const |
virtual PolynomialKernel * | deepCopy (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 PPath & | declaringFile () |
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. |
Definition at line 51 of file PolynomialKernel.h.
typedef Kernel PLearn::PolynomialKernel::inherited [private] |
Reimplemented from PLearn::Kernel.
Definition at line 53 of file PolynomialKernel.h.
PLearn::PolynomialKernel::PolynomialKernel | ( | ) |
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.
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_().
{ inherited::build(); build_(); }
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().
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); }
static const PPath& PLearn::PolynomialKernel::declaringFile | ( | ) | [inline, static] |
PolynomialKernel * PLearn::PolynomialKernel::deepCopy | ( | CopiesMap & | copies | ) | const [virtual] |
Reimplemented from PLearn::Kernel.
Definition at line 53 of file PolynomialKernel.cc.
** 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)); }
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)); }
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)); }
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)); }
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().
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().
{ inherited::makeDeepCopyFromShallowCopy(copies); }
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().