DissimilarityMatrix.
__getitem__
(index)[source]¶Slice into dissimilarity data by object ID or numpy indexing.
State: Experimental as of 0.4.0.
Extracts data from the dissimilarity matrix by object ID, a pair of IDs, or numpy indexing/slicing.
Parameters: | index (str, two-tuple of str, or numpy index) – index can be one of the following forms: an ID, a pair of IDs, or a numpy index. If index is a string, it is assumed to be an ID and a
If index is a two-tuple of strings, each string is assumed to be
an ID and the corresponding matrix element is returned that
represents the dissimilarity between the two IDs. Note that the
order of lookup by ID pair matters if the matrix is asymmetric: the
first ID will be used to look up the row, and the second ID will be
used to look up the column. Thus, Otherwise, index will be passed through to
|
---|---|
Returns: | Indexed data, where return type depends on the form of index (see description of index for more details). |
Return type: | ndarray or scalar |
Raises: | MissingIDError – If the ID(s) specified in index are not in the dissimilarity
matrix. |
Notes
The lookup based on ID(s) is quick.