Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::AdditiveNormalizationKernel Class Reference

#include <AdditiveNormalizationKernel.h>

Inheritance diagram for PLearn::AdditiveNormalizationKernel:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 AdditiveNormalizationKernel ()
 Default constructor.

 AdditiveNormalizationKernel (Ker the_source, bool remove_bias=false, bool remove_bias_in_evaluate=false, bool double_centering=false)
 Created from an existing kernel.

virtual void build ()
 Simply calls inherited::build() then build_().

virtual void makeDeepCopyFromShallowCopy (map< const void *, void * > &copies)
 Transforms a shallow copy into a deep copy.

 PLEARN_DECLARE_OBJECT (AdditiveNormalizationKernel)
virtual real evaluate (const Vec &x1, const Vec &x2) const
 Overridden.

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
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 real evaluate_i_x_again (int i, const Vec &x, real squared_norm_of_x=-1, bool first_time=false) const
 Return evaluate(data(i),x), where x is the same as in the precedent call to this same function (except if 'first_time' is true).

virtual real evaluate_x_i_again (const Vec &x, int i, real squared_norm_of_x=-1, bool first_time=false) const
virtual void computeGramMatrix (Mat K) const
 Call evaluate_i_j to fill each of the entries (i,j) of symmetric matrix K.

virtual void setDataForKernelMatrix (VMat the_data)
 ** Subclasses may overload these methods to provide efficient kernel matrix access **


Public Attributes

bool data_will_change
bool double_centering
bool remove_bias
bool remove_bias_in_evaluate

Protected Member Functions

real computeAverage (const Vec &x, bool on_row, real squared_norm_of_x=-1) const
 Return the average of K(x,x_i) or K(x_i,x), depending on the value of 'on_row' (true or false, respectively).


Static Protected Member Functions

void declareOptions (OptionList &ol)
 Declares this class' options.


Protected Attributes

Vec average_col
Vec average_row
real total_average
real total_average_unbiased
real avg_evaluate_i_x_again
 The last average computed in evaluate_i_x_again().

real avg_evaluate_x_i_again
 The last average computed in evaluate_x_i_again().

real factor
 A multiplicative factor to scale the result (1 or -1/2).


Private Types

typedef SourceKernel inherited

Private Member Functions

void build_ ()
 This does the actual building.


Private Attributes

Vec all_k_x
 Used to store the values of the source kernel.


Member Typedef Documentation

typedef SourceKernel PLearn::AdditiveNormalizationKernel::inherited [private]
 

Reimplemented from PLearn::SourceKernel.

Definition at line 57 of file AdditiveNormalizationKernel.h.


Constructor & Destructor Documentation

PLearn::AdditiveNormalizationKernel::AdditiveNormalizationKernel  ) 
 

Default constructor.

Definition at line 52 of file AdditiveNormalizationKernel.cc.

PLearn::AdditiveNormalizationKernel::AdditiveNormalizationKernel Ker  the_source,
bool  remove_bias = false,
bool  remove_bias_in_evaluate = false,
bool  double_centering = false
 

Created from an existing kernel.

Definition at line 60 of file AdditiveNormalizationKernel.cc.


Member Function Documentation

void PLearn::AdditiveNormalizationKernel::build  )  [virtual]
 

Simply calls inherited::build() then build_().

Reimplemented from PLearn::SourceKernel.

Definition at line 127 of file AdditiveNormalizationKernel.cc.

References build_().

void PLearn::AdditiveNormalizationKernel::build_  )  [private]
 

This does the actual building.

Reimplemented from PLearn::SourceKernel.

Definition at line 137 of file AdditiveNormalizationKernel.cc.

References double_centering, and factor.

Referenced by build().

real PLearn::AdditiveNormalizationKernel::computeAverage const Vec x,
bool  on_row,
real  squared_norm_of_x = -1
const [inline, protected]
 

Return the average of K(x,x_i) or K(x_i,x), depending on the value of 'on_row' (true or false, respectively).

Definition at line 155 of file AdditiveNormalizationKernel.cc.

References all_k_x, PLearn::TVec< T >::resize(), PLearn::sum(), PLearn::Vec, and x.

Referenced by evaluate(), evaluate_i_x(), evaluate_i_x_again(), evaluate_x_i(), and evaluate_x_i_again().

void PLearn::AdditiveNormalizationKernel::computeGramMatrix Mat  K  )  const [virtual]
 

Call evaluate_i_j to fill each of the entries (i,j) of symmetric matrix K.

Reimplemented from PLearn::SourceKernel.

Definition at line 168 of file AdditiveNormalizationKernel.cc.

References PLearn::Mat.

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

Declares this class' options.

Reimplemented from PLearn::SourceKernel.

Definition at line 86 of file AdditiveNormalizationKernel.cc.

References PLearn::declareOption(), and PLearn::OptionList.

real PLearn::AdditiveNormalizationKernel::evaluate const Vec x1,
const Vec x2
const [virtual]
 

Overridden.

Reimplemented from PLearn::SourceKernel.

Definition at line 176 of file AdditiveNormalizationKernel.cc.

References computeAverage(), factor, remove_bias, remove_bias_in_evaluate, total_average, and total_average_unbiased.

real PLearn::AdditiveNormalizationKernel::evaluate_i_j int  i,
int  j
const [virtual]
 

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

Reimplemented from PLearn::SourceKernel.

Definition at line 191 of file AdditiveNormalizationKernel.cc.

References average_col, average_row, factor, and total_average.

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

returns 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::SourceKernel.

Definition at line 198 of file AdditiveNormalizationKernel.cc.

References average_row, computeAverage(), factor, total_average, and x.

real PLearn::AdditiveNormalizationKernel::evaluate_i_x_again int  i,
const Vec x,
real  squared_norm_of_x = -1,
bool  first_time = false
const [virtual]
 

Return evaluate(data(i),x), where x is the same as in the precedent call to this same function (except if 'first_time' is true).

This can be used to speed up successive computations of K(x_i, x) (default version just calls evaluate_i_x).

Reimplemented from PLearn::Kernel.

Definition at line 206 of file AdditiveNormalizationKernel.cc.

References average_row, avg_evaluate_i_x_again, computeAverage(), factor, total_average, and x.

real PLearn::AdditiveNormalizationKernel::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::SourceKernel.

Definition at line 217 of file AdditiveNormalizationKernel.cc.

References average_col, computeAverage(), factor, total_average, and x.

real PLearn::AdditiveNormalizationKernel::evaluate_x_i_again const Vec x,
int  i,
real  squared_norm_of_x = -1,
bool  first_time = false
const [virtual]
 

Reimplemented from PLearn::Kernel.

Definition at line 225 of file AdditiveNormalizationKernel.cc.

References average_col, avg_evaluate_x_i_again, computeAverage(), factor, total_average, and x.

void PLearn::AdditiveNormalizationKernel::makeDeepCopyFromShallowCopy map< const void *, void * > &  copies  )  [virtual]
 

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::SourceKernel.

Definition at line 236 of file AdditiveNormalizationKernel.cc.

References PLERROR.

PLearn::AdditiveNormalizationKernel::PLEARN_DECLARE_OBJECT AdditiveNormalizationKernel   ) 
 

void PLearn::AdditiveNormalizationKernel::setDataForKernelMatrix VMat  the_data  )  [virtual]
 

** Subclasses may overload these methods to provide efficient kernel matrix access **

This method sets the data VMat that will be used to define the kernel matrix. It may precompute values from this that may later accelerate the evaluation of a kernel matrix element

Reimplemented from PLearn::SourceKernel.

Definition at line 253 of file AdditiveNormalizationKernel.cc.

References average_col, average_row, data_will_change, PLearn::TVec< T >::fill(), PLearn::TVec< T >::length(), PLearn::VMat::length(), remove_bias, PLearn::TVec< T >::resize(), PLearn::sum(), total_average, and total_average_unbiased.


Member Data Documentation

Vec PLearn::AdditiveNormalizationKernel::all_k_x [mutable, private]
 

Used to store the values of the source kernel.

Definition at line 60 of file AdditiveNormalizationKernel.h.

Referenced by computeAverage().

Vec PLearn::AdditiveNormalizationKernel::average_col [protected]
 

Definition at line 68 of file AdditiveNormalizationKernel.h.

Referenced by evaluate_i_j(), evaluate_x_i(), evaluate_x_i_again(), and setDataForKernelMatrix().

Vec PLearn::AdditiveNormalizationKernel::average_row [protected]
 

Definition at line 69 of file AdditiveNormalizationKernel.h.

Referenced by evaluate_i_j(), evaluate_i_x(), evaluate_i_x_again(), and setDataForKernelMatrix().

real PLearn::AdditiveNormalizationKernel::avg_evaluate_i_x_again [mutable, protected]
 

The last average computed in evaluate_i_x_again().

Definition at line 76 of file AdditiveNormalizationKernel.h.

Referenced by evaluate_i_x_again().

real PLearn::AdditiveNormalizationKernel::avg_evaluate_x_i_again [mutable, protected]
 

The last average computed in evaluate_x_i_again().

Definition at line 79 of file AdditiveNormalizationKernel.h.

Referenced by evaluate_x_i_again().

bool PLearn::AdditiveNormalizationKernel::data_will_change
 

Definition at line 90 of file AdditiveNormalizationKernel.h.

Referenced by setDataForKernelMatrix().

bool PLearn::AdditiveNormalizationKernel::double_centering
 

Definition at line 91 of file AdditiveNormalizationKernel.h.

Referenced by build_().

real PLearn::AdditiveNormalizationKernel::factor [protected]
 

A multiplicative factor to scale the result (1 or -1/2).

Definition at line 82 of file AdditiveNormalizationKernel.h.

Referenced by build_(), evaluate(), evaluate_i_j(), evaluate_i_x(), evaluate_i_x_again(), evaluate_x_i(), and evaluate_x_i_again().

bool PLearn::AdditiveNormalizationKernel::remove_bias
 

Definition at line 92 of file AdditiveNormalizationKernel.h.

Referenced by evaluate(), and setDataForKernelMatrix().

bool PLearn::AdditiveNormalizationKernel::remove_bias_in_evaluate
 

Definition at line 93 of file AdditiveNormalizationKernel.h.

Referenced by evaluate().

real PLearn::AdditiveNormalizationKernel::total_average [protected]
 

Definition at line 70 of file AdditiveNormalizationKernel.h.

Referenced by evaluate(), evaluate_i_j(), evaluate_i_x(), evaluate_i_x_again(), evaluate_x_i(), evaluate_x_i_again(), and setDataForKernelMatrix().

real PLearn::AdditiveNormalizationKernel::total_average_unbiased [protected]
 

Definition at line 71 of file AdditiveNormalizationKernel.h.

Referenced by evaluate(), and setDataForKernelMatrix().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:23:16 2004 for PLearn by doxygen 1.3.7