from landmark import landmarks
= landmarks(X, k = 10) ## Finds the indices of 25 landmarks
ind print(ind)
[ 0 45 15 40 2 6 21 16 10 29]
landmark
is a Python package that constructs landmarks \(L^\ast \subset X\) from a point set \(X \subset \mathbb{R}^d\) or a metric space \((X, d_X)\) that approximate the metric k-center problem:
\[ L^\ast \triangleq \mathop{\mathrm{argmin}}\limits_{\substack{L \subseteq X : \lvert L \rvert = k}} \ \max_{x \in X} d_X(x, L)\]
Below is an example a data set \(X\) (blue points), some sample landmarks \(L\) (red), along with the coverage (yellow) and packing (orange) properties they obey.
Given a point cloud \(X \in \mathbb{R}^{n \times d}\) represented as a numpy matrix with \(n\) points in \(d\) dimensions, the indices of the landmarks can be found with the landmarks
function:
from landmark import landmarks
ind = landmarks(X, k = 10) ## Finds the indices of 25 landmarks
print(ind)
[ 0 45 15 40 2 6 21 16 10 29]
The first \(k\)-indices of ind
are equivalent to the \(k\)-th prefix of the greedy permutation. You can get their covering radii and their predecessors by specifying full_output=True
: