#include <ProximityMatrix.h>
Inheritance diagram for prapi::ProximityMatrix:
It can use any proximity measure and it is able to treat both symmetric and nonsymmetric measures. The complexity of this process is O(N^{2}), where N is the number of samples.
Where can it be used, then? There are situations when you might want to scale your proximity measures using the mean or variance of measured distances between samples. This is needed when you have many feature vectors for each sample. Here is how to do the scaling:
//Let us suppose we have two feature vectors for each sample. //MyProximityMeasure is inherited from ProximityMeasure<int> MyProximityMeasure measure1, measure2; List<Sample<List<int> > > samples; //Create the samples somehow. //Create a multifeature proximity measure List<ProximityMeasure<int>* > measures; measures += &measure1; measures += &measure2; ProximityCombiner::WeightedSum combiner; MultiFeatureProximity<int> mfpm(measures,combiner); //First calculate scaling for the first feature vector mfpm.setEnabled(1,false); ProximityMatrix mat(mfpm, samples); //Scale the proximities for the first feature vector by //the variance of all proximities combiner.setWeight(0,1.0/util::Math<double>variance(mat)); mfpm.setEnabled(1,true); mfpm.setEnabled(0,false); ProximityMatrix mat2(mfpm, samples); combiner.setWeight(1,1.0/util::Math<double>variance(mat2)); mfpm.setEnabled(1,true); //Now, you have a multifeature proximity measure (mfpm) that //scales the proximities for each feature vector by the //variance of all proximities.
Public Methods  
ProximityMatrix ()  
Default constructor.  
ProximityMatrix (const ProximityMatrix &other)  
Copy constructor.  
ProximityMatrix (const Matrix< double > &other)  
Copy constructor for double matrices.  
ProximityMatrix &  operator= (const ProximityMatrix &other) 
Assignment operator.  
ProximityMatrix &  operator= (const Matrix< double > &other) 
Assignment operator for double matrices.  
template<class T, class I, class C>  ProximityMatrix (ProximityMeasure< T > &measure, List< Sample< T, I, C > > &samples) 
Create a proximity matrix out of the given samples using the given proximity measure.  
template<class T, class I, class C>  ProximityMatrix (ProximityMeasure< T > &measure, List< Sample< List< T >, I, C > > &samples, int featureIndex) 
Create a proximity matrix for a given feature from a list of multifeature samples.  
Static Public Methods  
template<class T, class I, class C> List< ProximityMatrix >  generateMatrices (List< ProximityMeasure< T > * > &measures, List< Sample< List< T >, I, C > > &samples) throw (InvalidArgumentException&) 
Generate a list of proximity matrices out of the given multifeature samples. 

Create a proximity matrix out of the given samples using the given proximity measure.


Create a proximity matrix for a given feature from a list of multifeature samples.


Generate a list of proximity matrices out of the given multifeature samples. A proximity matrix is created for each feature vector.
Example: MyProximityMeasure measure1, measure2; List<Sample<List<int> > > samples; //Create the samples somehow. List<ProximityMeasure<int>*> measures; measures += &measure1; measures += &measure2; List<ProximityMatrix> matrices(ProximityMatrix::generateMatrices(measures,samples)); //Look at the previous code samples for information on how the matrices //can be utilized.
