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

PLearn::KernelProjection Class Reference

#include <KernelProjection.h>

Inheritance diagram for PLearn::KernelProjection:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 KernelProjection ()
 Default constructor.

virtual Vec getEigenvalues ()
 Return the eigenvalues of this learner.

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 (KernelProjection)
virtual int outputsize () const
 Returns the size of this learner's output, (which typically may depend on its inputsize(), targetsize() and set options).

virtual void forget ()
 (Re-)initializes the PLearner in its fresh state (that state may depend on the 'seed' option) And sets 'stage' back to 0 (this is the stage of a fresh learner!).

virtual void train ()
 The role of the train method is to bring the learner up to stage==nstages, updating the train_stats collector with training costs measured on-line in the process.

virtual void computeOutput (const Vec &input, Vec &output) const
 Computes the output from the input.

virtual void computeCostsFromOutputs (const Vec &input, const Vec &output, const Vec &target, Vec &costs) const
 Computes the costs from already computed output.

virtual TVec< stringgetTestCostNames () const
 Returns the names of the costs computed by computeCostsFromOutpus (and thus the test method).

virtual TVec< stringgetTrainCostNames () const
 Returns the names of the objective costs that the train method computes and for which it updates the VecStatsCollector train_stats.

virtual void setTrainingSet (VMat training_set, bool call_forget=true)
 Overridden to forward to the kernel.


Public Attributes

bool compute_costs
bool free_extra_components
int ignore_n_first
Ker kernel
real min_eigenvalue
int n_comp
int n_comp_for_cost
int normalize
Vec eigenvalues
Mat eigenvectors

Static Protected Member Functions

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


Protected Attributes

int n_comp_kept
int n_examples
bool first_output
 A boolean indicating we haven't performed any output yet.

Vec last_input
 The last input given when computing costs.

Vec last_output
 The last output computed when computing costs.


Private Types

typedef PLearner inherited

Private Member Functions

void build_ ()
 This does the actual building.


Private Attributes

Vec k_x_xi
 Global storage to save memory allocations.

Mat result
Mat used_eigenvectors

Member Typedef Documentation

typedef PLearner PLearn::KernelProjection::inherited [private]
 

Reimplemented from PLearn::PLearner.

Reimplemented in PLearn::Isomap, PLearn::KernelPCA, PLearn::LLE, and PLearn::SpectralClustering.

Definition at line 58 of file KernelProjection.h.


Constructor & Destructor Documentation

PLearn::KernelProjection::KernelProjection  ) 
 

Default constructor.

Definition at line 53 of file KernelProjection.cc.

References PLearn::normalize(), and REAL_MAX.


Member Function Documentation

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

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

Reimplemented from PLearn::PLearner.

Reimplemented in PLearn::Isomap, PLearn::KernelPCA, PLearn::LLE, and PLearn::SpectralClustering.

Definition at line 129 of file KernelProjection.cc.

References build_().

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

This does the actual building.

Reimplemented from PLearn::PLearner.

Reimplemented in PLearn::Isomap, PLearn::KernelPCA, PLearn::LLE, and PLearn::SpectralClustering.

Definition at line 138 of file KernelProjection.cc.

References first_output, last_input, n_comp, n_comp_kept, normalize, PLERROR, and PLearn::TVec< T >::resize().

Referenced by build().

void PLearn::KernelProjection::computeCostsFromOutputs const Vec input,
const Vec output,
const Vec target,
Vec costs
const [virtual]
 

Computes the costs from already computed output.

Implements PLearn::PLearner.

Definition at line 157 of file KernelProjection.cc.

References PLearn::abs(), compute_costs, PLearn::dot(), PLearn::endl(), kernel, last_input, last_output, PLearn::TVec< T >::length(), MISSING_VALUE, n_comp_for_cost, PLearn::pownorm(), PLearn::TVec< T >::resize(), and PLearn::TVec< T >::subVec().

void PLearn::KernelProjection::computeOutput const Vec input,
Vec output
const [virtual]
 

Computes the output from the input.

Implements PLearn::PLearner.

Definition at line 201 of file KernelProjection.cc.

References eigenvalues, eigenvectors, first_output, k_x_xi, kernel, n_comp_kept, n_examples, normalize, PLERROR, PLearn::TMat< T >::resize(), PLearn::TVec< T >::resize(), result, PLearn::rowSum(), PLearn::sqrt(), PLearn::TMat< T >::subMatRows(), and used_eigenvectors.

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

Declares this class' options.

Reimplemented from PLearn::PLearner.

Reimplemented in PLearn::Isomap, PLearn::KernelPCA, PLearn::LLE, and PLearn::SpectralClustering.

Definition at line 75 of file KernelProjection.cc.

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

void PLearn::KernelProjection::forget  )  [virtual]
 

(Re-)initializes the PLearner in its fresh state (that state may depend on the 'seed' option) And sets 'stage' back to 0 (this is the stage of a fresh learner!).

Implements PLearn::PLearner.

Reimplemented in PLearn::Isomap, PLearn::KernelPCA, PLearn::LLE, and PLearn::SpectralClustering.

Definition at line 237 of file KernelProjection.cc.

References eigenvalues, eigenvectors, first_output, last_input, PLearn::Mat, n_comp, n_comp_kept, n_examples, PLearn::TVec< T >::resize(), and PLearn::Vec.

virtual Vec PLearn::KernelProjection::getEigenvalues  )  [inline, virtual]
 

Return the eigenvalues of this learner.

Definition at line 128 of file KernelProjection.h.

References eigenvalues.

TVec< string > PLearn::KernelProjection::getTestCostNames  )  const [virtual]
 

Returns the names of the costs computed by computeCostsFromOutpus (and thus the test method).

Implements PLearn::PLearner.

Definition at line 252 of file KernelProjection.cc.

References PLearn::TVec< T >::append(), and compute_costs.

Referenced by getTrainCostNames().

TVec< string > PLearn::KernelProjection::getTrainCostNames  )  const [virtual]
 

Returns the names of the objective costs that the train method computes and for which it updates the VecStatsCollector train_stats.

Implements PLearn::PLearner.

Definition at line 269 of file KernelProjection.cc.

References getTestCostNames().

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

Transforms a shallow copy into a deep copy.

Reimplemented in PLearn::Isomap, PLearn::KernelPCA, PLearn::LLE, and PLearn::SpectralClustering.

Definition at line 277 of file KernelProjection.cc.

References PLERROR.

int PLearn::KernelProjection::outputsize  )  const [virtual]
 

Returns the size of this learner's output, (which typically may depend on its inputsize(), targetsize() and set options).

Implements PLearn::PLearner.

Definition at line 295 of file KernelProjection.cc.

References n_comp_kept.

PLearn::KernelProjection::PLEARN_DECLARE_OBJECT KernelProjection   ) 
 

void PLearn::KernelProjection::setTrainingSet VMat  training_set,
bool  call_forget = true
[virtual]
 

Overridden to forward to the kernel.

Reimplemented from PLearn::PLearner.

Definition at line 303 of file KernelProjection.cc.

References kernel, PLearn::VMat::length(), n_examples, and PLERROR.

Referenced by PLearn::IsomapTangentLearner::build_(), and PLearn::KPCATangentLearner::train().

void PLearn::KernelProjection::train  )  [virtual]
 

The role of the train method is to bring the learner up to stage==nstages, updating the train_stats collector with training costs measured on-line in the process.

Implements PLearn::PLearner.

Definition at line 320 of file KernelProjection.cc.

References eigenvalues, PLearn::eigenVecOfSymmMat(), eigenvectors, PLearn::endl(), first_output, PLearn::flush(), free_extra_components, ignore_n_first, kernel, PLearn::TMat< T >::length(), PLearn::TVec< T >::length(), min_eigenvalue, n_comp, n_comp_kept, n_examples, PLWARNING, PLearn::TMat< T >::resize(), PLearn::TVec< T >::resize(), PLearn::TMat< T >::subMatRows(), PLearn::TVec< T >::subVec(), and PLearn::TMat< T >::width().

Referenced by PLearn::KPCATangentLearner::train(), and PLearn::IsomapTangentLearner::train().


Member Data Documentation

bool PLearn::KernelProjection::compute_costs
 

Definition at line 88 of file KernelProjection.h.

Referenced by computeCostsFromOutputs(), and getTestCostNames().

Vec PLearn::KernelProjection::eigenvalues
 

Definition at line 101 of file KernelProjection.h.

Referenced by computeOutput(), forget(), getEigenvalues(), and train().

Mat PLearn::KernelProjection::eigenvectors
 

Definition at line 102 of file KernelProjection.h.

Referenced by PLearn::KPCATangentLearner::computeOutput(), computeOutput(), PLearn::IsomapTangentLearner::computeOutput(), forget(), and train().

bool PLearn::KernelProjection::first_output [mutable, protected]
 

A boolean indicating we haven't performed any output yet.

Definition at line 77 of file KernelProjection.h.

Referenced by build_(), computeOutput(), forget(), and train().

bool PLearn::KernelProjection::free_extra_components
 

Definition at line 89 of file KernelProjection.h.

Referenced by train().

int PLearn::KernelProjection::ignore_n_first
 

Definition at line 90 of file KernelProjection.h.

Referenced by train().

Vec PLearn::KernelProjection::k_x_xi [mutable, private]
 

Global storage to save memory allocations.

Definition at line 61 of file KernelProjection.h.

Referenced by computeOutput().

Ker PLearn::KernelProjection::kernel
 

Definition at line 91 of file KernelProjection.h.

Referenced by computeCostsFromOutputs(), PLearn::KPCATangentLearner::computeOutput(), computeOutput(), PLearn::IsomapTangentLearner::computeOutput(), setTrainingSet(), and train().

Vec PLearn::KernelProjection::last_input [mutable, protected]
 

The last input given when computing costs.

Definition at line 79 of file KernelProjection.h.

Referenced by build_(), computeCostsFromOutputs(), and forget().

Vec PLearn::KernelProjection::last_output [mutable, protected]
 

The last output computed when computing costs.

Definition at line 80 of file KernelProjection.h.

Referenced by computeCostsFromOutputs().

real PLearn::KernelProjection::min_eigenvalue
 

Definition at line 92 of file KernelProjection.h.

Referenced by train().

int PLearn::KernelProjection::n_comp
 

Definition at line 93 of file KernelProjection.h.

Referenced by build_(), PLearn::IsomapTangentLearner::build_(), forget(), PLearn::KPCATangentLearner::train(), and train().

int PLearn::KernelProjection::n_comp_for_cost
 

Definition at line 94 of file KernelProjection.h.

Referenced by computeCostsFromOutputs().

int PLearn::KernelProjection::n_comp_kept [protected]
 

Definition at line 71 of file KernelProjection.h.

Referenced by build_(), computeOutput(), forget(), outputsize(), and train().

int PLearn::KernelProjection::n_examples [protected]
 

Reimplemented from PLearn::PLearner.

Definition at line 72 of file KernelProjection.h.

Referenced by computeOutput(), forget(), setTrainingSet(), and train().

int PLearn::KernelProjection::normalize
 

Definition at line 95 of file KernelProjection.h.

Referenced by build_(), and computeOutput().

Mat PLearn::KernelProjection::result [mutable, private]
 

Definition at line 62 of file KernelProjection.h.

Referenced by computeOutput().

Mat PLearn::KernelProjection::used_eigenvectors [mutable, private]
 

Definition at line 63 of file KernelProjection.h.

Referenced by computeOutput().


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