Skip to main content

High-performance PAM (k-medoids) clustering implemented in Rust with Python bindings

Project description

RustPAM

High-performance k-medoids (OneBatchPAM) clustering with a Rust core.

PyPI version Python 3.10+ License: MIT

Installation

Install from PyPI:

pip install rustpam

For development installation:

# Clone the repository
git clone https://github.com/yourusername/rustpam.git
cd rustpam

# Install in development mode
pip install maturin
maturin develop --release

Quick Start

import numpy as np
from rustpam import OneBatchPAM

# Sample data
X = np.random.randn(1000, 10).astype(np.float32)

# Create and fit model
model = OneBatchPAM(
    n_medoids=3,
    distance="euclidean",
    max_iter=50,
    random_state=42,
    n_threads=2,
)
model.fit(X)

# Results
print("Medoid indices:", model.medoid_indices_)
print("Inertia:", model.inertia_)
print("Iterations:", model.n_iter_)

# Predict new samples
X_new = np.random.randn(20, X.shape[1]).astype(np.float32)
labels = model.predict(X_new)
print("Predicted labels:", labels)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Built with:

  • PyO3 - Rust bindings for Python
  • Maturin - Build tool for Rust Python packages
  • Rayon - Data parallelism library
  • ndarray - N-dimensional arrays

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

rustpam-0.2.0.tar.gz (25.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rustpam-0.2.0-cp313-cp313-win_amd64.whl (177.4 kB view details)

Uploaded CPython 3.13Windows x86-64

rustpam-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl (303.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

rustpam-0.2.0-cp313-cp313-macosx_11_0_arm64.whl (265.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rustpam-0.2.0-cp313-cp313-macosx_10_12_x86_64.whl (279.7 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

rustpam-0.2.0-cp312-cp312-win_amd64.whl (177.5 kB view details)

Uploaded CPython 3.12Windows x86-64

rustpam-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl (303.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

rustpam-0.2.0-cp312-cp312-macosx_11_0_arm64.whl (265.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rustpam-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl (279.7 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

rustpam-0.2.0-cp311-cp311-win_amd64.whl (176.8 kB view details)

Uploaded CPython 3.11Windows x86-64

rustpam-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl (305.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

rustpam-0.2.0-cp311-cp311-macosx_11_0_arm64.whl (265.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rustpam-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl (279.7 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

rustpam-0.2.0-cp310-cp310-win_amd64.whl (177.0 kB view details)

Uploaded CPython 3.10Windows x86-64

rustpam-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl (305.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

rustpam-0.2.0-cp310-cp310-macosx_11_0_arm64.whl (265.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

rustpam-0.2.0-cp310-cp310-macosx_10_12_x86_64.whl (279.9 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

Details for the file rustpam-0.2.0.tar.gz.

File metadata

  • Download URL: rustpam-0.2.0.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rustpam-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9d092c8ba10d4a4a935581b786901b98da85ca106141af728c6bec7e701d8b80
MD5 ec6b14dc073cfa329a828cf421edeea5
BLAKE2b-256 b4e2600eda4622b38bd7b242752740eba222611c60f49b1a0d9a2e6e94fc9ce4

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0.tar.gz:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rustpam-0.2.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 177.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rustpam-0.2.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b75c672075889ec17afcc62892d7b6cb0fe46322ad8508ed4e901a5dec1e93b2
MD5 1c344706e462a734f033e922b0901cdf
BLAKE2b-256 78f609c7af566832673be9cbfd9c79fcc1438bac6eb1e6711fed9fafd820749d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp313-cp313-win_amd64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 74032c7a73c92046e001cf4a4ae153d7412a16a6400bfb1461703e937fb1596e
MD5 ec02027ff352ae7c6b7dd430c78fd2e7
BLAKE2b-256 547ce827110b06cb76d8aaa5f98ac3d718876714f9782a34518f0510b009dbc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp313-cp313-manylinux_2_34_x86_64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2628f842dbc9787d68ce5ea160f4e989a9d91f9fc3989560ee54283b6ed801e5
MD5 0aac4f381be8642ff27c63694b8ec710
BLAKE2b-256 7659d2b964fe5030cf88b7a87bef8779f246743fb22c564c1e3bee5d5913efc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7973c29827b66f32a3e55c1d4b762f46fb2c16d5fc88fbad090353a3734ec4e9
MD5 773e802acc90c383daf8ec4a4e24bd23
BLAKE2b-256 7e62cfcf89748d25f3b7118a47c3f5a3d1b69f63be2b743c710f2fb227b983ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: rustpam-0.2.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 177.5 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rustpam-0.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 15abf29b1e105f210e8deddfd11f1f91c283a3f13dee2e7a1b57071aad657862
MD5 d5e4458d9114eeba1c715439e3df2717
BLAKE2b-256 6f20fefce14f0b1a32fbf76ffacf3538a77ac311865957b2845e83c3cdadb579

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp312-cp312-win_amd64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 128049e3b8ada7d86da9ddac4c55bd098842a599551f6e80a6a7b70c9e6418ee
MD5 b3413c7e8bc15915039dfb7a7189bb43
BLAKE2b-256 faee0e52d6f53e6aa0f8dd53cc851d9b2ddf305a30bafd4ac471a0eb946815ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 982c3029abd0f0ceb16cee3cf44fae7875da363282abf7c161c9bb52ba3d35c9
MD5 41ddcfda8c9d147b5a44de8b7f40442f
BLAKE2b-256 a7867ae27cd1276ff4969a8da6500c30f58b6209766f0ece62aea24101b4ab0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 c217c8b55fb363b03168c40099d137013e0a4d9785b366fd983110fe2c2bc98e
MD5 43eaa3cce73b20184a4243228492ac7b
BLAKE2b-256 ba36946f57ce248348877a75073c790cfdba4ec226a60b24caaba4baa459296a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: rustpam-0.2.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 176.8 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rustpam-0.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 274167f05e86f42e6477e41e932614a7dd9546ca380e798c0bdeb9c138143c6c
MD5 85685407d2b8ae2b8ec7551e1e5e3052
BLAKE2b-256 18fb7fcb90549cd0fb1ee288a69254c69a7436b641ef6134795231690aec7b03

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp311-cp311-win_amd64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 aaf92f369af2928cbe7073c147645adf79797f5f421c6b335006f79563147ee2
MD5 a5921e3c2e50da90e21d7773ef5bc1c1
BLAKE2b-256 e92cd134d1337942a313edff7f765e07f385cda2380d0d19579effc7cb4328fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c9709f762f52c237ec68dd3d45c58d866dd5122cd98545e1ab16742ec6f7850b
MD5 d5e5bae285835c3c3ff8fa7a09b4fb79
BLAKE2b-256 93a8860452a384b57f3aa313fceb34cbd6d8ba6e1115b995d9b0ef08d2451e0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 48edf9b733388f3dce1e66984c44e5eba8a877a095d58490f977efa372b6d447
MD5 804c8958683c4f6364a7d79add1bb1a7
BLAKE2b-256 d6afd3fda1015c164c1474ac1aa00fa8e5fc5d226f0296fe2c68c6b53041a13f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: rustpam-0.2.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 177.0 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rustpam-0.2.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1562f30dcddce5035c00eae6b7d58145d1eeb25af4bc167b076d83fb0a0fe593
MD5 63553af6aa51d01fe8df5a14a8da0d3a
BLAKE2b-256 41570637807f42e169eb391484a361fdc57ee33c1c9982ae11ab9ce2f7e7add2

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp310-cp310-win_amd64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 64777fa023584fbf8a70d4789b9488f985a89ed5d710562eeb563824e7d2a8b8
MD5 d6b861b2a95745d2a0c597bd715134b7
BLAKE2b-256 4445aac2cf1ada8a1809a848a7ba0b312fa4a594642672f9d1d19b5fb1cea066

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp310-cp310-manylinux_2_34_x86_64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a6f0321c3eb767fa89338919cc36b3d05e4537ba547a87cda827698bbae872b4
MD5 8c8d910a24041907051441975a6706c2
BLAKE2b-256 ca7d2cfeadcdf2944f48976b3234d54b0429c705b9ad8b40baa1a4e51870257a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rustpam-0.2.0-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.0-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 92bfa795d7293c2c9a9edd291b80f8db4e550056d14a33e9cf94c2745e1835d9
MD5 eb287313e47fa95f1d407dd2ff6e8229
BLAKE2b-256 3efa287fd5d82bf99d15cd08c18bc65447fda433de157df4ccd1be4b27bb4687

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.0-cp310-cp310-macosx_10_12_x86_64.whl:

Publisher: release.yml on Hanziwww/rustpam

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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