LID#

class scio.scores.LID(*, act_norm=None, mode='raw', k=?)[source]#

Bases: BaseScoreClassif

LID for classification.

Parameters:
  • k (int) – Number of nearest neighbors used for LID estimation.

  • mode – See BaseScoreClassif.

  • act_norm – See BaseScore.

References

[MLW+18]

Xingjun Ma, Bo Li, Yisen Wang, Sarah M. Erfani, Sudanthi Wijewickrema, Grant Schoenebeck, Michael E. Houle, Dawn Song, and James Bailey. Characterizing adversarial subspaces using Local Intrinsic Dimensionality. In International Conference on Learning Representations. 2018. URL: https://openreview.net/forum?id=B1gJ1L2aW.

Hint

Below this point, the documentation is meant for development purposes only. Manual use of any listed member is highly discouraged. For usage, see Inferring with Confidence.

Useful methods defined here

compute_lid(sorted_distances)

Compute LID estimator for batch.

compute_lid(sorted_distances)[source]#

Compute LID estimator for batch.

Parameters:

sorted_distances (Tensor) – Shape (n_samples, self.k), sorted along dim=1. Distances to nearest neighbors.

Returns:

LID (float) – Shape (n_samples,). Estimator for LID from [MLW+18].