#include <GaussianKernel.h>
Inheritance diagram for PLearn::GaussianKernel:
Public Member Functions | |
GaussianKernel () | |
Default constructor. | |
GaussianKernel (real the_sigma) | |
Convenient constructor. | |
PLEARN_DECLARE_OBJECT (GaussianKernel) | |
virtual void | build () |
Should call simply inherited::build(), then this class's build_(). | |
virtual void | makeDeepCopyFromShallowCopy (map< const void *, void * > &copies) |
real | evaluateFromSquaredNormOfDifference (real sqnorm_of_diff) const |
real | evaluateFromDotAndSquaredNorm (real sqnorm_x1, real dot_x1_x2, real sqnorm_x2) const |
virtual void | setDataForKernelMatrix (VMat the_data) |
This method precomputes the squared norm for all the data to later speed up evaluate methods. | |
virtual void | addDataForKernelMatrix (const Vec &newRow) |
This method appends the newRow squared norm to the squarednorms Vec field. | |
virtual real | evaluate (const Vec &x1, const Vec &x2) const |
returns K(x1,x2) | |
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 |
returns 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)) | |
virtual void | setParameters (Vec paramvec) |
default version produces an error | |
Public Attributes | |
bool | scale_by_sigma |
Build options below. | |
real | sigma |
Static Protected Member Functions | |
void | declareOptions (OptionList &ol) |
redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down) | |
Protected Attributes | |
real | minus_one_over_sigmasquare |
-1 / sigma^2 | |
real | sigmasquare_over_two |
sigma^2 / 2 | |
Vec | squarednorms |
squarednorms of the rows of the data VMat (data is a member of Kernel) | |
Private Types | |
typedef Kernel | inherited |
Private Member Functions | |
void | build_ () |
Definition at line 54 of file GaussianKernel.h.
|
Reimplemented from PLearn::Kernel. Definition at line 59 of file GaussianKernel.h. |
|
Default constructor.
Definition at line 59 of file GaussianKernel.cc. |
|
Convenient constructor.
Definition at line 64 of file GaussianKernel.cc. References build_(). |
|
This method appends the newRow squared norm to the squarednorms Vec field.
Reimplemented from PLearn::Kernel. Definition at line 111 of file GaussianKernel.cc. References PLearn::TVec< T >::length(), PLearn::VMat::length(), PLERROR, PLearn::pownorm(), PLearn::TVec< T >::resize(), and squarednorms. |
|
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 88 of file GaussianKernel.cc. References build_(). |
|
This method should be redefined in subclasses and do the actual building of the object according to previously set option fields. Constructors can just set option fields, and then call build_. This method is NOT virtual, and will typically be called only from three places: a constructor, the public virtual build() method, and possibly the public virtual read method (which calls its parent's read). build_() can assume that it's parent's build_ has already been called. Reimplemented from PLearn::Kernel. Definition at line 97 of file GaussianKernel.cc. References minus_one_over_sigmasquare, sigma, sigmasquare_over_two, and PLearn::square(). Referenced by build(), and GaussianKernel(). |
|
redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options) ( see the declareOption function further down) ex: static void declareOptions(OptionList& ol) { declareOption(ol, "inputsize", &MyObject::inputsize_, OptionBase::buildoption, "the size of the input\n it must be provided"); declareOption(ol, "weights", &MyObject::weights, OptionBase::learntoption, "the learnt model weights"); inherited::declareOptions(ol); } Reimplemented from PLearn::Kernel. Definition at line 74 of file GaussianKernel.cc. References PLearn::declareOption(), and PLearn::OptionList. |
|
returns K(x1,x2)
Implements PLearn::Kernel. Definition at line 155 of file GaussianKernel.cc. References PLearn::TVec< T >::data(), evaluateFromSquaredNormOfDifference(), PLearn::TVec< T >::length(), PLERROR, and val. |
|
returns evaluate(data(i),data(j))
Reimplemented from PLearn::Kernel. Definition at line 177 of file GaussianKernel.cc. References PLearn::endl(), evaluateFromDotAndSquaredNorm(), PLERROR, PLearn::pownorm(), and squarednorms. |
|
returns evaluate(data(i),x)
Reimplemented from PLearn::Kernel. Definition at line 200 of file GaussianKernel.cc. References evaluateFromDotAndSquaredNorm(), PLearn::pownorm(), squarednorms, and x. |
|
returns evaluate(x,data(i))
Reimplemented from PLearn::Kernel. Definition at line 226 of file GaussianKernel.cc. References evaluateFromDotAndSquaredNorm(), PLearn::pownorm(), squarednorms, and x. |
|
Definition at line 90 of file GaussianKernel.h. References evaluateFromDotAndSquaredNorm(). Referenced by evaluate_i_j(), evaluate_i_x(), evaluate_x_i(), and evaluateFromDotAndSquaredNorm(). |
|
Definition at line 134 of file GaussianKernel.cc. References PLearn::exp(), minus_one_over_sigmasquare, PLERROR, scale_by_sigma, and sigmasquare_over_two. Referenced by evaluate(). |
|
Definition at line 104 of file GaussianKernel.cc. References PLearn::deepCopyField(), and squarednorms. |
|
|
|
This method precomputes the squared norm for all the data to later speed up evaluate methods.
Reimplemented from PLearn::Kernel. Definition at line 236 of file GaussianKernel.cc. References PLearn::VMat::length(), PLearn::TVec< T >::resize(), and squarednorms. |
|
default version produces an error
Reimplemented from PLearn::Kernel. Definition at line 247 of file GaussianKernel.cc. References minus_one_over_sigmasquare, PLWARNING, and sigma. |
|
-1 / sigma^2
Definition at line 69 of file GaussianKernel.h. Referenced by build_(), evaluateFromSquaredNormOfDifference(), and setParameters(). |
|
Build options below.
Definition at line 64 of file GaussianKernel.h. Referenced by evaluateFromSquaredNormOfDifference(). |
|
Definition at line 65 of file GaussianKernel.h. Referenced by build_(), and setParameters(). |
|
sigma^2 / 2
Definition at line 70 of file GaussianKernel.h. Referenced by build_(), and evaluateFromSquaredNormOfDifference(). |
|
squarednorms of the rows of the data VMat (data is a member of Kernel)
Definition at line 72 of file GaussianKernel.h. Referenced by addDataForKernelMatrix(), evaluate_i_j(), evaluate_i_x(), evaluate_x_i(), makeDeepCopyFromShallowCopy(), and setDataForKernelMatrix(). |