repair_distance_matrix | R Documentation |
This function can repair distance matrix to satisfy all conditions needed for proper input for algorithms which are looking for points positions.
repair_distance_matrix(m, max.iter = 5)
m |
original distance matrix |
max.iter |
= 5, repairing third metric rule can be a little bit tricky when there are many triples combination which don't fulfill it. In such situation many iterations are needed. If number of needed iteration exceeds max.iter, simple matrix will be returned when all possible distances between points will be equal to the mean distance in original matrix. |
If matrix is not square, it will be extended to fulfill this condition
All NA will be replaced by real values
All negative values will be changed by abs function
First metric rule will be forced (d(x,y) = 0 <=> x = y)
Second metric rule will be forced (d(x,y) = d(y,x))
Third metric rule will be forced (d(x,z) <= d(x,y) + d(y,z))
All changes are performed in intelligent way to change original matrix as less as possible
repaired distance matrix (or original if repairing is not needed)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.