Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes

CMultidimensionalScaling Class Reference

Detailed Description

the class Multidimensionalscaling is used to perform multidimensional scaling (capable of landmark approximation if requested).

Description of classical embedding is given on p.261 (Section 12.1) of Borg, I., & Groenen, P. J. F. (2005). Modern multidimensional scaling: Theory and applications. Springer.

Description of landmark MDS approximation is given in

Sparse multidimensional scaling using landmark points V De Silva, J B Tenenbaum (2004) Technology, p. 1-4

In this preprocessor the LAPACK routine DSYEVR is used for solving an eigenproblem. If ARPACK library is available, its routines DSAUPD/DSEUPD are used instead.

Note that target dimension should be set with reasonable value (using set_target_dim). In case it is higher than intrinsic dimensionality of the dataset 'extra' features of the output might be inconsistent (essentially, according to zero or negative eigenvalues). In this case a warning is showed.

It is possible to apply multidimensional scaling to any given distance using apply_to_distance_matrix method. By default euclidean distance is used (with parallel instance replaced by preprocessor's one).

Faster landmark approximation is parallel using pthreads. As for choice of landmark number it should be at least 3 for proper triangulation. For reasonable embedding accuracy greater values (30-50% of total examples number) is pretty good for the most tasks.

Definition at line 59 of file MultidimensionalScaling.h.

Inheritance diagram for CMultidimensionalScaling:
Inheritance graph

List of all members.

Public Member Functions

 CMultidimensionalScaling ()
virtual ~CMultidimensionalScaling ()
virtual CSimpleFeatures
< float64_t > * 
embed_distance (CDistance *distance)
virtual CFeaturesapply (CFeatures *features)
const char * get_name () const
SGVector< float64_tget_eigenvalues () const
void set_landmark_number (int32_t num)
int32_t get_landmark_number () const
void set_landmark (bool landmark)
bool get_landmark () const

Protected Member Functions

virtual void init ()
SGMatrix< float64_tclassic_embedding (SGMatrix< float64_t > distance_matrix)
SGMatrix< float64_tlandmark_embedding (SGMatrix< float64_t > distance_matrix)
virtual SGMatrix< float64_tprocess_distance_matrix (SGMatrix< float64_t > distance_matrix)

Static Protected Member Functions

static void * run_triangulation_thread (void *p)
static SGVector< int32_t > shuffle (int32_t count, int32_t total_count)

Protected Attributes

SGVector< float64_tm_eigenvalues
bool m_landmark
int32_t m_landmark_number

Constructor & Destructor Documentation

Definition at line 60 of file MultidimensionalScaling.cpp.

~CMultidimensionalScaling (  )  [virtual]

Definition at line 76 of file MultidimensionalScaling.cpp.

Member Function Documentation

CFeatures * apply ( CFeatures features  )  [virtual]

apply preprocessor to feature matrix, changes feature matrix to the one having target dimensionality

features features which feature matrix should be processed
new feature matrix

Implements CEmbeddingConverter.

Definition at line 136 of file MultidimensionalScaling.cpp.

SGMatrix< float64_t > classic_embedding ( SGMatrix< float64_t distance_matrix  )  [protected]

classical embedding

distance_matrix distance matrix to be used for embedding
new feature matrix representing given distance

Definition at line 149 of file MultidimensionalScaling.cpp.

CSimpleFeatures< float64_t > * embed_distance ( CDistance distance  )  [virtual]

apply preprocessor to CDistance

distance (should be approximate euclidean for consistent result)
new features with distance similar to given as much as possible

Definition at line 114 of file MultidimensionalScaling.cpp.

SGVector< float64_t > get_eigenvalues (  )  const

get last embedding eigenvectors

vector with last eigenvalues

Definition at line 81 of file MultidimensionalScaling.cpp.

bool get_landmark (  )  const

getter for landmark parameter

true if landmark embedding is used

Definition at line 104 of file MultidimensionalScaling.cpp.

int32_t get_landmark_number (  )  const

get number of landmarks

current number of landmarks

Definition at line 94 of file MultidimensionalScaling.cpp.

const char * get_name (  )  const [virtual]

get name

Reimplemented from CEmbeddingConverter.

Reimplemented in CIsomap.

Definition at line 109 of file MultidimensionalScaling.cpp.

void init (  )  [protected, virtual]


default initialization

Reimplemented from CEmbeddingConverter.

Reimplemented in CIsomap.

Definition at line 69 of file MultidimensionalScaling.cpp.

SGMatrix< float64_t > landmark_embedding ( SGMatrix< float64_t distance_matrix  )  [protected]

landmark embedding (approximate, accuracy varies with m_landmark_num parameter)

distance_matrix distance matrix to be used for embedding
new feature matrix representing given distance matrix

Definition at line 270 of file MultidimensionalScaling.cpp.

SGMatrix< float64_t > process_distance_matrix ( SGMatrix< float64_t distance_matrix  )  [protected, virtual]

process distance matrix (redefined in isomap, for mds does nothing)

distance_matrix distance matrix
processed distance matrix

Reimplemented in CIsomap.

Definition at line 131 of file MultidimensionalScaling.cpp.

void * run_triangulation_thread ( void *  p  )  [static, protected]


run triangulation thread for landmark embedding

p thread parameters

Definition at line 406 of file MultidimensionalScaling.cpp.

void set_landmark ( bool  landmark  ) 

setter for landmark parameter

landmark true if landmark embedding should be used

Definition at line 99 of file MultidimensionalScaling.cpp.

void set_landmark_number ( int32_t  num  ) 

set number of landmarks should be lesser than number of examples and greater than 3 for consistent embedding as triangulation is used

num number of landmark to be set

Definition at line 86 of file MultidimensionalScaling.cpp.

SGVector< int32_t > shuffle ( int32_t  count,
int32_t  total_count 
) [static, protected]

subroutine used to shuffle count indexes among of total_count ones with Fisher-Yates (known as Knuth too) shuffle algorithm

count number of indexes to be shuffled and returned
total_count total number of indexes
sorted shuffled indexes for landmarks

Definition at line 448 of file MultidimensionalScaling.cpp.

Member Data Documentation


last embedding eigenvalues

Definition at line 140 of file MultidimensionalScaling.h.

bool m_landmark [protected]

use landmark approximation?

Definition at line 143 of file MultidimensionalScaling.h.

int32_t m_landmark_number [protected]

number of landmarks

Definition at line 146 of file MultidimensionalScaling.h.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation