#include <DistanceKernel.h>
Inheritance diagram for PLearn::DistanceKernel:
Public Member Functions | |
DistanceKernel (real the_Ln=2) | |
PLEARN_DECLARE_OBJECT (DistanceKernel) | |
virtual string | info () const |
returns a bit more informative string about object (default returns classname()) | |
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 void | setDataForKernelMatrix (VMat the_data) |
This method precomputes the squared norm for all the data to later speed up evaluate methods, if n == 2. | |
Public Attributes | |
bool | pow_distance |
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 | n |
1 for L1, 2 for L2, etc.. | |
Vec | squarednorms |
Used to store the squared norm of the input data. | |
Private Types | |
typedef Kernel | inherited |
Definition at line 52 of file DistanceKernel.h.
|
Reimplemented from PLearn::Kernel. Definition at line 57 of file DistanceKernel.h. |
|
Definition at line 55 of file DistanceKernel.cc. |
|
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 63 of file DistanceKernel.cc. References PLearn::declareOption(), and PLearn::OptionList. |
|
returns K(x1,x2)
Implements PLearn::Kernel. Definition at line 78 of file DistanceKernel.cc. References PLearn::dist(), n, pow_distance, PLearn::powdistance(), and PLearn::Vec. |
|
returns evaluate(data(i),data(j))
Reimplemented from PLearn::Kernel. Definition at line 89 of file DistanceKernel.cc. References n, PLERROR, pow_distance, PLearn::sqrt(), and squarednorms. |
|
returns a bit more informative string about object (default returns classname())
Reimplemented from PLearn::Object. Definition at line 73 of file DistanceKernel.h. References n, and PLearn::tostring(). |
|
|
|
This method precomputes the squared norm for all the data to later speed up evaluate methods, if n == 2.
Reimplemented from PLearn::Kernel. Definition at line 119 of file DistanceKernel.cc. References PLearn::VMat::length(), n, PLearn::TVec< T >::resize(), and squarednorms. Referenced by PLearn::RemoveDuplicateVMatrix::build_(), and PLearn::KNNVMatrix::build_(). |
|
1 for L1, 2 for L2, etc..
Definition at line 61 of file DistanceKernel.h. Referenced by evaluate(), evaluate_i_j(), info(), and setDataForKernelMatrix(). |
|
Definition at line 67 of file DistanceKernel.h. Referenced by PLearn::RemoveDuplicateVMatrix::build_(), evaluate(), and evaluate_i_j(). |
|
Used to store the squared norm of the input data.
Definition at line 63 of file DistanceKernel.h. Referenced by evaluate_i_j(), and setDataForKernelMatrix(). |