#include <KernelProjection.h>
Inheritance diagram for PLearn::KernelProjection:
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< string > | getTestCostNames () const |
Returns the names of the costs computed by computeCostsFromOutpus (and thus the test method). | |
virtual TVec< string > | getTrainCostNames () 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 |
|
Reimplemented from PLearn::PLearner. Reimplemented in PLearn::Isomap, PLearn::KernelPCA, PLearn::LLE, and PLearn::SpectralClustering. Definition at line 58 of file KernelProjection.h. |
|
Default constructor.
Definition at line 53 of file KernelProjection.cc. References PLearn::normalize(), and REAL_MAX. |
|
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_(). |
|
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(). |
|
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(). |
|
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. |
|
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. |
|
(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. |
|
Return the eigenvalues of this learner.
Definition at line 128 of file KernelProjection.h. References eigenvalues. |
|
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(). |
|
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(). |
|
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. |
|
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. |
|
|
|
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(). |
|
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(). |
|
Definition at line 88 of file KernelProjection.h. Referenced by computeCostsFromOutputs(), and getTestCostNames(). |
|
Definition at line 101 of file KernelProjection.h. Referenced by computeOutput(), forget(), getEigenvalues(), and train(). |
|
Definition at line 102 of file KernelProjection.h. Referenced by PLearn::KPCATangentLearner::computeOutput(), computeOutput(), PLearn::IsomapTangentLearner::computeOutput(), forget(), and train(). |
|
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(). |
|
Definition at line 89 of file KernelProjection.h. Referenced by train(). |
|
Definition at line 90 of file KernelProjection.h. Referenced by train(). |
|
Global storage to save memory allocations.
Definition at line 61 of file KernelProjection.h. Referenced by computeOutput(). |
|
Definition at line 91 of file KernelProjection.h. Referenced by computeCostsFromOutputs(), PLearn::KPCATangentLearner::computeOutput(), computeOutput(), PLearn::IsomapTangentLearner::computeOutput(), setTrainingSet(), and train(). |
|
The last input given when computing costs.
Definition at line 79 of file KernelProjection.h. Referenced by build_(), computeCostsFromOutputs(), and forget(). |
|
The last output computed when computing costs.
Definition at line 80 of file KernelProjection.h. Referenced by computeCostsFromOutputs(). |
|
Definition at line 92 of file KernelProjection.h. Referenced by train(). |
|
Definition at line 93 of file KernelProjection.h. Referenced by build_(), PLearn::IsomapTangentLearner::build_(), forget(), PLearn::KPCATangentLearner::train(), and train(). |
|
Definition at line 94 of file KernelProjection.h. Referenced by computeCostsFromOutputs(). |
|
Definition at line 71 of file KernelProjection.h. Referenced by build_(), computeOutput(), forget(), outputsize(), and train(). |
|
Reimplemented from PLearn::PLearner. Definition at line 72 of file KernelProjection.h. Referenced by computeOutput(), forget(), setTrainingSet(), and train(). |
|
Definition at line 95 of file KernelProjection.h. Referenced by build_(), and computeOutput(). |
|
Definition at line 62 of file KernelProjection.h. Referenced by computeOutput(). |
|
Definition at line 63 of file KernelProjection.h. Referenced by computeOutput(). |