Click or drag to resize
Dissimilarities Class
Computes a matrix of dissimilarities (or similarities) between the columns (or rows) of a matrix.
Inheritance Hierarchy

Namespace: Imsl.Stat
Assembly: ImslCS (in ImslCS.dll) Version:
public class Dissimilarities

The Dissimilarities type exposes the following members.

Public methodCompute
Computes a matrix of dissimilarities (or similarities) between the columns (or rows) of a matrix.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public propertyDistanceMatrix
The distance matrix.
Public propertyDistanceMethod
The method in computing the dissimilarities or similarities.
Public propertyIndex
The indices of the rows.
Public propertyNumberOfProcessors
Perform the parallel calculations with the maximum possible number of processors set to NumberOfProcessors.
Public propertyRow
Identifies whether distances are computed between rows or columns of x.
Public propertyScalingOption
The scaling option used if the L2Norm, L1Norm, or InfinityNorm distance methods are specified. See DistanceMethod.

Class Dissimilarities computes an upper triangular matrix (excluding the diagonal) of dissimilarities (or similarities) between the columns (or rows) of a matrix. Nine different distance measures can be computed. For the first three measures, three different scaling options can be employed. The distance matrix computed is generally used as input to clustering or multidimensional scaling functions.

The following discussion assumes that the distance measure is being computed between the columns of the matrix. If distances between the rows of the matrix are desired, use Row = true.

The distance method and scaling option used by Dissimilarities can be set via properties DistanceMethod and ScalingOption, respectively. For distance methods L2Norm, L1Norm, or InfinityNorm, each row of x is first scaled according to the value of ScalingOption. The scaling parameters are obtained from the values in the row scaled as either the standard deviation of the row or the row range; the standard deviation is computed from the unbiased estimate of the variance. If no scaling is performed, the parameters in the following discussion are all 1.0 (see ScalingOption). Once the scaling value (if any) has been computed, the distance between column i and column j is computed via the difference vector z_k=\frac{(x_k-y_k)}{s_k},i=1,\ldots,ndstm, where x_k denotes the k-th element in the i-th column, y_k denotes the corresponding element in the j-th column, and ndstm is the number of rows if differencing columns and the number of columns if differencing rows. For given z_i, the distance methods that allow scaling are defined as:

L2NormEuclidean distance (L_2
L1NormSum of the absolute differences (L_1 norm)
InfinityNormMaximum difference (L_\infty

The following distance measures do not allow for scaling.

MahalanobisMahalanobis distance
AbsCosineAbsolute value of the cosine of the angle between the vectors
AngleInRadiansAngle in radians (0, \pi) between the lines through the origin defined by the vectors
CorrelationCoefficientCorrelation coefficient
AbsCorrelationCoefficientAbsolute value of the correlation coefficient
ExactMatchesNumber of exact matches, where x_i = y_i.

For the Mahalanobis distance, any variable used in computing the distance measure that is (numerically) linearly dependent upon the previous variables in the Index property is omitted from the distance measure.

See Also