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

PLearn::KNNVMatrix Class Reference

#include <KNNVMatrix.h>

Inheritance diagram for PLearn::KNNVMatrix:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 KNNVMatrix ()
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 (KNNVMatrix)

Public Attributes

VMat k_nn_mat
Ker kernel_pij
int knn
bool report_progress

Protected Member Functions

int getSourceIndexOf (int i, int &i_ref, int &i_n) const
 Return the index in the source matrix of the sample number i in this matrix.

int getTag (int p) const
 Return the tag of the sample number p in a bag: p == 0 => 1 p == knn-1 => 2 otherwise => 0 (If knn == 1, always return 3).

virtual void getNewRow (int i, const Vec &v) const
 Needed because it's a SourceVMatrix.


Static Protected Member Functions

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


Protected Attributes

Mat nn
 Store the nearest neighbours of each point.

Mat pij
 Store the pij weights, if a kernel_pij is provided.


Private Types

typedef SourceVMatrix inherited

Private Member Functions

void build_ ()
 This does the actual building.


Private Attributes

Vec source_row
 Used to store a row of the source VMatrix.


Member Typedef Documentation

typedef SourceVMatrix PLearn::KNNVMatrix::inherited [private]
 

Reimplemented from PLearn::SourceVMatrix.

Definition at line 58 of file KNNVMatrix.h.


Constructor & Destructor Documentation

PLearn::KNNVMatrix::KNNVMatrix  ) 
 

Definition at line 54 of file KNNVMatrix.cc.


Member Function Documentation

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

simply calls inherited::build() then build_()

Reimplemented from PLearn::SourceVMatrix.

Definition at line 102 of file KNNVMatrix.cc.

References build_().

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

This does the actual building.

Reimplemented from PLearn::SourceVMatrix.

Definition at line 111 of file KNNVMatrix.cc.

References PLearn::Kernel::build(), PLearn::Kernel::computeGramMatrix(), PLearn::Kernel::computeNeighbourMatrixFromDistanceMatrix(), PLearn::VMat::getSubRow(), PLearn::PP< T >::isNull(), k, k_nn_mat, kernel_pij, knn, PLearn::TVec< T >::length(), PLearn::VMat::length(), nn, pij, PLERROR, PLWARNING, PLearn::Kernel::report_progress, report_progress, PLearn::TMat< T >::resize(), PLearn::TMat< T >::row(), PLearn::DistanceKernel::setDataForKernelMatrix(), PLearn::SourceVMatrix::setMetaInfoFromSource(), PLearn::sum(), and PLearn::VMat::width().

Referenced by build().

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

Declares this class' options.

Reimplemented from PLearn::SourceVMatrix.

Definition at line 75 of file KNNVMatrix.cc.

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

void PLearn::KNNVMatrix::getNewRow int  i,
const Vec v
const [protected, virtual]
 

Needed because it's a SourceVMatrix.

Reimplemented from PLearn::SourceVMatrix.

Definition at line 304 of file KNNVMatrix.cc.

References getSourceIndexOf(), getTag(), PLearn::VMatrix::inputsize(), kernel_pij, pij, PLearn::TVec< T >::resize(), source_row, PLearn::TVec< T >::subVec(), PLearn::VMatrix::targetsize(), PLearn::VMatrix::weightsize(), and PLearn::VMat::width().

int PLearn::KNNVMatrix::getSourceIndexOf int  i,
int i_ref,
int i_n
const [inline, protected]
 

Return the index in the source matrix of the sample number i in this matrix.

Also return in i_n the neighbour rank, and in i_ref the reference point.

Definition at line 294 of file KNNVMatrix.cc.

References knn, and nn.

Referenced by getNewRow().

int PLearn::KNNVMatrix::getTag int  p  )  const [inline, protected]
 

Return the tag of the sample number p in a bag: p == 0 => 1 p == knn-1 => 2 otherwise => 0 (If knn == 1, always return 3).

Definition at line 333 of file KNNVMatrix.cc.

References knn.

Referenced by getNewRow().

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

Transforms a shallow copy into a deep copy.

Reimplemented from PLearn::SourceVMatrix.

Definition at line 268 of file KNNVMatrix.cc.

References PLearn::deepCopyField(), kernel_pij, nn, pij, PLWARNING, and source_row.

PLearn::KNNVMatrix::PLEARN_DECLARE_OBJECT KNNVMatrix   ) 
 


Member Data Documentation

VMat PLearn::KNNVMatrix::k_nn_mat
 

Definition at line 82 of file KNNVMatrix.h.

Referenced by build_().

Ker PLearn::KNNVMatrix::kernel_pij
 

Definition at line 83 of file KNNVMatrix.h.

Referenced by build_(), getNewRow(), and makeDeepCopyFromShallowCopy().

int PLearn::KNNVMatrix::knn
 

Definition at line 84 of file KNNVMatrix.h.

Referenced by build_(), getSourceIndexOf(), and getTag().

Mat PLearn::KNNVMatrix::nn [protected]
 

Store the nearest neighbours of each point.

Definition at line 71 of file KNNVMatrix.h.

Referenced by build_(), getSourceIndexOf(), and makeDeepCopyFromShallowCopy().

Mat PLearn::KNNVMatrix::pij [protected]
 

Store the pij weights, if a kernel_pij is provided.

Definition at line 74 of file KNNVMatrix.h.

Referenced by build_(), getNewRow(), and makeDeepCopyFromShallowCopy().

bool PLearn::KNNVMatrix::report_progress
 

Definition at line 85 of file KNNVMatrix.h.

Referenced by build_().

Vec PLearn::KNNVMatrix::source_row [mutable, private]
 

Used to store a row of the source VMatrix.

Definition at line 61 of file KNNVMatrix.h.

Referenced by getNewRow(), and makeDeepCopyFromShallowCopy().


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