Skip to main content

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

Project description

RustPAM

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

PyPI version Python 3.10+ License: MIT CI Rust PyO3 Rayon NumPy Maturin

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

  • Rust 🦀 - Memory-safe systems programming language
  • PyO3 🐍 - Rust bindings for Python
  • Maturin 📦 - Build and publish Rust-based Python packages
  • Rayon ⚡ - Data parallelism library for fearless concurrency
  • ndarray 🔢 - N-dimensional arrays for numerical computing

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.1.tar.gz (23.9 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.1-cp313-cp313-win_amd64.whl (177.7 kB view details)

Uploaded CPython 3.13Windows x86-64

rustpam-0.2.1-cp313-cp313-manylinux_2_34_x86_64.whl (303.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

rustpam-0.2.1-cp313-cp313-macosx_11_0_arm64.whl (265.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rustpam-0.2.1-cp313-cp313-macosx_10_12_x86_64.whl (280.0 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

rustpam-0.2.1-cp312-cp312-win_amd64.whl (177.7 kB view details)

Uploaded CPython 3.12Windows x86-64

rustpam-0.2.1-cp312-cp312-manylinux_2_34_x86_64.whl (304.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

rustpam-0.2.1-cp312-cp312-macosx_11_0_arm64.whl (265.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rustpam-0.2.1-cp312-cp312-macosx_10_12_x86_64.whl (280.0 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

rustpam-0.2.1-cp311-cp311-win_amd64.whl (177.1 kB view details)

Uploaded CPython 3.11Windows x86-64

rustpam-0.2.1-cp311-cp311-manylinux_2_34_x86_64.whl (305.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

rustpam-0.2.1-cp311-cp311-macosx_11_0_arm64.whl (266.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rustpam-0.2.1-cp311-cp311-macosx_10_12_x86_64.whl (280.0 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

rustpam-0.2.1-cp310-cp310-win_amd64.whl (177.3 kB view details)

Uploaded CPython 3.10Windows x86-64

rustpam-0.2.1-cp310-cp310-manylinux_2_34_x86_64.whl (305.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

rustpam-0.2.1-cp310-cp310-macosx_11_0_arm64.whl (266.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

rustpam-0.2.1-cp310-cp310-macosx_10_12_x86_64.whl (280.2 kB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rustpam-0.2.1.tar.gz
  • Upload date:
  • Size: 23.9 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.1.tar.gz
Algorithm Hash digest
SHA256 af00bba852f9b5d5924af8813ab4cc911c102bea7d3c0228d4857353ec608f97
MD5 584574b97beb92abc4b4b09e50d9ef60
BLAKE2b-256 f2ece72d92e900c9d076d537ee2b8aa55554977f9331cd1cf2d3363e49135bf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1.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.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: rustpam-0.2.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 177.7 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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 19a831c2f69320e8f5a9d511f2c1912ca4c96004b4d28d1a7f28bb02775ca842
MD5 fd2c2a0af699a0189890c40001a5ed57
BLAKE2b-256 6ebb3bba3c3adf88694b0371711298deadd4607e9e723fa4f41eb2fc8963bdbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 961e8247bd88e9935f0208a4144a89499ad87ccc719bd986be018cd9279d0614
MD5 434f88cd4c415444662b451fc6fda4a4
BLAKE2b-256 faa968b0989c1e6761eb71ac0ee9419185d4532a37fa1e2a00b92b809a3bb388

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 918a57b91d0cf99804930fa20159a5aec2ee622b6df030fe9786c819d8e8577d
MD5 cb519a1eddc236efcc16955626fa0083
BLAKE2b-256 a5875e45c1ffed4e6f70b555aa0f4736cf90b44b8eebdf4eae9e6b5c44d8a28d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6fbeb2b755c8a899c937023c0c6cbc6f45f74688f44293cba158ebdf58a3d71b
MD5 cd6f3249f2c405ad2040044b8b380123
BLAKE2b-256 e5b572bf90b901f192c0c24994ce7539dadef159764b6f423aa732eb1fe5e4dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: rustpam-0.2.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 177.7 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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5230a10298f0db40a558b58d706e71ae1bdc4900b6b6c6ccb8217c7722b0937d
MD5 50eefdf2d1c95091388a0968e0202814
BLAKE2b-256 a2da090c91fc708e4595fb909ec7938d00f33b2dea56512a65693fa7d758ee4c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 62a2e85660164bca4033e3d6ca528887df89e3dc67b5e8d9b07a9e38f9b0da96
MD5 ec48ebfd7359b3033c7a9c9a563c2256
BLAKE2b-256 0f7303a76560cfc50d1ec3d5cbf1d08967409a5da2bf2827067db58449a014fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 03e905ae5313707cddaa00c2fdd2f6762c2130dc4cdeb47e163d46c4f386cbaa
MD5 89542d982b06ad02aa1ced80a1efb092
BLAKE2b-256 53d98ebb43c038b0980ea840ed7e5df58b67754d3db9a3feb9c2d706f60378ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3ac678014d68652569e6c2e4c12777ab6776549ec61fd06df0db2e0473fd91fe
MD5 9cff8ecb21b62dbe7ff92bbf9f826ee4
BLAKE2b-256 0379faf773ecbf8dca05cf02bc5c0692753c6c00021951252910a089eb3964be

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: rustpam-0.2.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 177.1 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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 208ab9b719cc3aa320a5c6d6e6f59a4fb8ccfbea7c349837a496add882cabd8e
MD5 e18ab1df284cc5828445795a7d955bf9
BLAKE2b-256 065338c0e2b704dc684054e418ac8af02f4769918dc23d507f6ac587c0972611

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.1-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4cad2de7b2f15b39c1d444ee4c21df96e67c9c0b458aa68b82bf80aa8eeccb36
MD5 b978ebc089e3966056d365d7588efd58
BLAKE2b-256 37ed4b576d651d27f42fe0916bae6f6610f968cd478788ff811b73f34da79174

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9836e3efdc2191627ed56134b01d8205323eeb6f0453de79f5976ef0ec406e73
MD5 f189ef22c02c45d7b3c5ef8e16e56f53
BLAKE2b-256 fab2869b69ad28a112383d0a22cef62112f75097819a0357c2e1af2f4bcc0da1

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cb09a50386bcf8bb66553de8ac694298e0359ec620f4634277ac191195072f76
MD5 17a201242f6a1b030b8006bcea422205
BLAKE2b-256 b9ac2cff2a009df498e1885162688893b41b8499c4732f1dd052af358eec2a93

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: rustpam-0.2.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 177.3 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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 87aabe1358f5e3a9c794c50178b1581a6b32caf072de526987701425ea083c7f
MD5 6b623ad2bf35003fe5354f3dd35252bd
BLAKE2b-256 43a9bc5a52ea205aaec52e4925f9dc81589a533d2686705ad2c34bb1925037b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.1-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 592c1cfaf8412beac95c95cb24caad24a0478d93122a9f590bef6ff3a981ed96
MD5 15656901d161b3d4815341ce9c4d88cb
BLAKE2b-256 d09df1b0fb94f9c931c7f465fc2c0d52cfd1eb73f912a7777f6204b8e14b4b68

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2744d76b8f5cca7e5cafb6b686b0fa80d0ad35bd4bc442e71c0d3977eaee8243
MD5 3c909b56e8e1a3754db92edc1fb9fc16
BLAKE2b-256 1979feaaceea3261d7b7c9778c2c442bb161190da2acb5c8721e2b73a8c36c82

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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.1-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rustpam-0.2.1-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b27d7c7de0e72d9e82ceec89039b7a6ba425c2a3df2004f207528e7bd2cdae5f
MD5 855dd1c792a2587b36bc5919f289567c
BLAKE2b-256 dbb6c2e6be58481fd7db970585784f7ae4109995c6d55c6c254f7b2635dc2468

See more details on using hashes here.

Provenance

The following attestation bundles were made for rustpam-0.2.1-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