Skip to main content

No project description provided

Project description

landmark

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 (also known k-center clustering problem):

$$ L^\ast \triangleq \mathop{\mathrm{argmin}}\limits_{\substack{L \subseteq X : \lvert L \rvert = k}} \ \max_{x \in X} d_X(x, L)$$

Metric $k$-center is a classic NP-hard problem intrinsically similar to other classical problems, such as geometric set cover and facility location; its output is also related to other geometric constructions, like r-nets and well-separated pair decompositions.

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.

Landmarks example

Installation

Clone and use:

python -m pip install < landmark-py location >

Warning: this package is very early-stage, e.g. does not offer wheels on PyPI. Use with care.

Usage

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 = 25) ## Finds the indices of 25 landmarks
print(ind)
# [0, 32, 45, 16, ...]

The first $k$-indices of ind are equivalent to the $k$-th prefix of the greedy permutation. You can get their covering radii by specifying radii = True:

from landmark import landmarks
ind, radii = landmarks(X, k = 25, radii = True) ## Finds the indices of 25 landmarks
print(ind, radii)
# [0, 32, 45, 16, ...]
# [inf 31.6024 28.4495 20.3045 ...]

For more examples, see notebook example.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scikit_landmark-0.0.5.tar.gz (683.2 kB view hashes)

Uploaded Source

Built Distributions

scikit_landmark-0.0.5-cp312-cp312-win_amd64.whl (80.4 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

scikit_landmark-0.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (111.5 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

scikit_landmark-0.0.5-cp312-cp312-macosx_11_0_arm64.whl (73.5 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

scikit_landmark-0.0.5-cp312-cp312-macosx_10_9_x86_64.whl (76.6 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

scikit_landmark-0.0.5-cp311-cp311-win_amd64.whl (81.3 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

scikit_landmark-0.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (111.5 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

scikit_landmark-0.0.5-cp311-cp311-macosx_11_0_arm64.whl (75.0 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

scikit_landmark-0.0.5-cp311-cp311-macosx_10_9_x86_64.whl (77.8 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

scikit_landmark-0.0.5-cp310-cp310-win_amd64.whl (79.0 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

scikit_landmark-0.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (110.4 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

scikit_landmark-0.0.5-cp310-cp310-macosx_11_0_arm64.whl (73.3 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

scikit_landmark-0.0.5-cp310-cp310-macosx_10_9_x86_64.whl (76.2 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

scikit_landmark-0.0.5-cp39-cp39-win_amd64.whl (79.1 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

scikit_landmark-0.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (110.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

scikit_landmark-0.0.5-cp39-cp39-macosx_11_0_arm64.whl (73.5 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

scikit_landmark-0.0.5-cp39-cp39-macosx_10_9_x86_64.whl (76.3 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

scikit_landmark-0.0.5-cp38-cp38-win_amd64.whl (78.9 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

scikit_landmark-0.0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (110.5 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

scikit_landmark-0.0.5-cp38-cp38-macosx_11_0_arm64.whl (73.3 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

scikit_landmark-0.0.5-cp38-cp38-macosx_10_9_x86_64.whl (76.0 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page