Skip to content

Latest commit

 

History

History
45 lines (28 loc) · 1.67 KB

isolation_distance.rst

File metadata and controls

45 lines (28 loc) · 1.67 KB

Isolation distance (isolation_distance)

Calculation

  • C : cluster of interest.
  • N_s : number of spikes within cluster C.
  • N_n : number of spikes outside of cluster C.
  • N_{min} : minimum of N_s and N_n.
  • \mu_C, \Sigma_C : mean vector and covariance matrix for spikes within C (where each spike within C is represented by a vector of principal components (PCs)).
  • D_{i,C}^2 : for every spike i (represented by vector x_i) outside of cluster C, the Mahalanobis distance (as below) between \mu_c and x_i is calculated. These distances are ordered from smallest to largest. The N_{min}'th entry in this list is the isolation distance.
D_{i,C}^2 = (x_i - \mu_C)^T \Sigma_C^{-1} (x_i - \mu_C)

Geometrically, the isolation distance for cluster C is the radius of the circle which contains N_{min} spikes from cluster C and N_{min} spikes outside of the cluster C.

Expectation and use

Isolation distance can be interpreted as a measure of distance from the cluster to the nearest other cluster. A well isolated unit should have a large isolation distance.

Example code

import spikeinterface.qualitymetrics as sqm

iso_distance, _ = sqm.isolation_distance(all_pcs=all_pcs, all_labels=all_labels, this_unit_id=0)

References

.. autofunction:: spikeinterface.qualitymetrics.pca_metrics.mahalanobis_metrics


Literature

Introduced by [Harris]_.