What is a square dissimilarity matrix?

A dissimilarity matrix $$D$$ is defined by the dissimilarities  of a set of objects $$R$$ to another set $$C$$: $$D = D(R,C)$$. In case $$R = C$$ the matrix has as many rows as columns. So $$D_{ii}$$ refers to the dissimilarity of an object to itself: often this is zero, but this is not necessary. Moreover, it is not needed that $$D_{ij} = D_{ji}$$ as a square dissimilarity matrix is not necessarily symmetric.

In case a square dissimilarity matrix is stored in a PRTools dataset, it is expected that the feature labels are set identical to the object labels. Below it is shown how to realize this for dissimilarities computed by a user routine my_dissim operating on a set of objects A with labels laba

D = my_dissim(A);
D = prdataset(D,laba);
D = setfeatlab(D,laba);
% D = setfeatlab(D,getlabels(D)); % Alternative

The DisTools package contains a routine issquare for testing the above conditions.

Print Friendly, PDF & Email