skbio.stats.distance.
DissimilarityMatrix
(data, ids=None)[source]¶Store dissimilarities between objects.
A DissimilarityMatrix instance stores a square, hollow, two-dimensional matrix of dissimilarities between objects. Objects could be, for example, samples or DNA sequences. A sequence of IDs accompanies the dissimilarities.
Methods are provided to load and save dissimilarity matrices from/to disk, as well as perform common operations such as extracting dissimilarities based on object ID.
Parameters: | data : array_like or DissimilarityMatrix
ids : sequence of str, optional
|
---|
Notes
The dissimilarities are stored in redundant (square-form) format [R62].
The data are not checked for symmetry, nor guaranteed/assumed to be symmetric.
References
[R62] | (1, 2) http://docs.scipy.org/doc/scipy/reference/spatial.distance.html |
Attributes
T |
Transpose of the dissimilarity matrix. |
data |
Array of dissimilarities. |
dtype |
Data type of the dissimilarities. |
ids |
Tuple of object IDs. |
png |
Display heatmap in IPython Notebook as PNG. |
shape |
Two-element tuple containing the dissimilarity matrix dimensions. |
size |
Total number of elements in the dissimilarity matrix. |
svg |
Display heatmap in IPython Notebook as SVG. |
Methods
x in dm |
Check if the specified ID is in the dissimilarity matrix. |
dm1 == dm2 |
Compare this dissimilarity matrix to another for equality. |
dm[x] |
Slice into dissimilarity data by object ID or numpy indexing. |
dm1 != dm2 |
Determine whether two dissimilarity matrices are not equal. |
str(dm) |
Return a string representation of the dissimilarity matrix. |
copy () |
Return a deep copy of the dissimilarity matrix. |
filter (ids[, strict]) |
Filter the dissimilarity matrix by IDs. |
index (lookup_id) |
Return the index of the specified ID. |
plot ([cmap, title]) |
Creates a heatmap of the dissimilarity matrix |
read (file[, format]) |
Create a new DissimilarityMatrix instance from a file. |
redundant_form () |
Return an array of dissimilarities in redundant format. |
to_data_frame () |
Create a pandas.DataFrame from this DissimilarityMatrix . |
transpose () |
Return the transpose of the dissimilarity matrix. |
write (file[, format]) |
Write an instance of DissimilarityMatrix to a file. |