edu.stanford.math.plex4.metric.landmark
T
- the underlying type of the metric spacepublic abstract class LandmarkSelector<T> extends java.lang.Object implements AbstractSearchableMetricSpace<T>
This abstract class defines the functionality of a landmark set within an arbitrary finite metric space. A landmark set is used as an approximation to the whole metric space for efficiency purposes. It also tends to denoise the dataset under investigation. For further information about landmark sets, please consult the paper "Topological estimation using witness complexes", by Vin de Silva and Gunnar Carlsson.
A class that derives from LandmarkSelector must implement the computeLandmarkSet function which implements the computation of the landmark set.
Modifier and Type | Field and Description |
---|---|
protected int[] |
indexMapping
This array holds the mapping between the indices of the landmark points,
and the indices within the metric space.
|
protected int |
landmarkSetSize
This is the size of the landmark set
|
protected AbstractSearchableMetricSpace<T> |
metricSpace
This is the underlying metric space upon which the landmark set is build.
|
Constructor and Description |
---|
LandmarkSelector(AbstractSearchableMetricSpace<T> metricSpace,
int landmarkSetSize)
This constructor initializes the landmark selector with a finite metric
space, and a size parameter.
|
LandmarkSelector(AbstractSearchableMetricSpace<T> metricSpace,
int[] indices) |
Modifier and Type | Method and Description |
---|---|
protected abstract int[] |
computeLandmarkSet()
This function constructs the set of landmark points.
|
double |
distance(int i,
int j)
This function returns the distance between the object at index i and the
object at index j.
|
double |
distance(T a,
T b)
This function returns the distance between two points.
|
gnu.trove.TIntHashSet |
getClosedNeighborhood(T queryPoint,
double epsilon)
This function returns the set of indices of points that are contained in the closed ball
of radius epsilon, centered at the specified query point.
|
gnu.trove.TIntHashSet |
getKNearestNeighbors(T queryPoint,
int k)
This function returns the indices of the k points that are closest to the given query point.
|
int |
getLandmarkIndex(int i)
This function returns the index of the i-th landmark point.
|
int[] |
getLandmarkPoints() |
double |
getMaxDistanceFromPointsToLandmarks()
This function returns the maximum distance between points in the landmark
selection and points not in the selection.
|
int |
getNearestPointIndex(T queryPoint)
This function returns the index of the point within the metric space nearest to
the given query point.
|
gnu.trove.TIntHashSet |
getOpenNeighborhood(T queryPoint,
double epsilon)
This function returns the set of indices of points that are contained in the open ball
of radius epsilon, centered at the specified query point.
|
T |
getPoint(int index)
This function returns the point at the specified index.
|
T[] |
getPoints()
This function returns the set of points in the metric space as an array.
|
AbstractSearchableMetricSpace<T> |
getUnderlyingMetricSpace() |
int |
size()
This function returns the number of points in the metric space.
|
protected final AbstractSearchableMetricSpace<T> metricSpace
protected final int landmarkSetSize
protected final int[] indexMapping
public LandmarkSelector(AbstractSearchableMetricSpace<T> metricSpace, int landmarkSetSize)
metricSpace
- the metric space to build the landmarks set inlandmarkSetSize
- the size of the landmark setpublic LandmarkSelector(AbstractSearchableMetricSpace<T> metricSpace, int[] indices)
public int getLandmarkIndex(int i)
i
- the index within the set of landmark pointspublic int[] getLandmarkPoints()
public int size()
AbstractIntMetricSpace
size
in interface AbstractIntMetricSpace
public double distance(int i, int j)
AbstractIntMetricSpace
distance
in interface AbstractIntMetricSpace
i
- the index of the first objectj
- the index of the second objectpublic double distance(T a, T b)
AbstractObjectMetric
distance
in interface AbstractObjectMetric<T>
a
- the first pointb
- the second pointpublic T getPoint(int index)
AbstractObjectMetricSpace
getPoint
in interface AbstractObjectMetricSpace<T>
index
- the index of the point to retrievepublic AbstractSearchableMetricSpace<T> getUnderlyingMetricSpace()
public T[] getPoints()
AbstractObjectMetricSpace
getPoints
in interface AbstractObjectMetricSpace<T>
protected abstract int[] computeLandmarkSet()
public double getMaxDistanceFromPointsToLandmarks()
public gnu.trove.TIntHashSet getClosedNeighborhood(T queryPoint, double epsilon)
AbstractSearchableMetricSpace
getClosedNeighborhood
in interface AbstractSearchableMetricSpace<T>
queryPoint
- the center of the closed ballepsilon
- the radius of the closed ballpublic gnu.trove.TIntHashSet getOpenNeighborhood(T queryPoint, double epsilon)
AbstractSearchableMetricSpace
getOpenNeighborhood
in interface AbstractSearchableMetricSpace<T>
queryPoint
- the center of the open ballepsilon
- the radius of the open ballpublic gnu.trove.TIntHashSet getKNearestNeighbors(T queryPoint, int k)
AbstractSearchableMetricSpace
getKNearestNeighbors
in interface AbstractSearchableMetricSpace<T>
queryPoint
- the reference pointk
- the number of nearest neighbors to getpublic int getNearestPointIndex(T queryPoint)
AbstractSearchableMetricSpace
getNearestPointIndex
in interface AbstractSearchableMetricSpace<T>
queryPoint
- the query point