Skip to main content

Spectral Bridges clustering algorithm

Project description

Spectral Bridges

Spectral Bridges is a Python package that implements a novel clustering algorithm combining k-means and spectral clustering techniques. It leverages efficient affinity matrix computation and merges clusters based on a connectivity measure inspired by SVM's margin concept. This package is designed to provide robust clustering solutions, particularly suited for large datasets.

Features

  • Spectral Bridges Algorithm: Integrates k-means and spectral clustering with efficient affinity matrix calculation for improved clustering results.
  • Scalability: Designed to handle large datasets by optimizing cluster formation through advanced affinity matrix computations.
  • Customizable: Parameters such as number of clusters, iterations, and random state allow flexibility in clustering configurations.

Speed

Starting with version 1.0.0, Spectral Bridges not only utilizes FAISS's efficient k-means implementation but also uses a scikit-learn method clone for centroid initialization which is much faster (over 2x improvement).

Installation

You can install the package via pip:

pip install spectral-bridges

Usage

Example

from spectralbridges import SpectralBridges
import numpy as np

# Generate sample data
np.random.seed(0)
X = np.random.rand(100, 10)  # Replace with your dataset

# Initialize and fit Spectral Bridges
model = SpectralBridges(n_clusters=5, n_nodes=10, random_state=42)
model.fit(X)

# Predict clusters for new data points
new_data = np.random.rand(20, 10)  # Replace with new data
predicted_clusters = model.predict(new_data)

print("Predicted clusters:", predicted_clusters)

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

spectral_bridges-1.1.5.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

spectral_bridges-1.1.5-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file spectral_bridges-1.1.5.tar.gz.

File metadata

  • Download URL: spectral_bridges-1.1.5.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for spectral_bridges-1.1.5.tar.gz
Algorithm Hash digest
SHA256 af4236a2e4ec878f9b3caa749c6d2436488b5cb1828bb1a328fcfb92ff698f9c
MD5 e169e23cbebb22eadeafefb50566be91
BLAKE2b-256 2f6ccdb51c2d880e33578df805b67a2daae7657eb68fe9249a10965e44f5c9c8

See more details on using hashes here.

File details

Details for the file spectral_bridges-1.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for spectral_bridges-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c69f2988fd5eb19f2fc76181f72fa26ea862fb88eea9047b43d1614d4178ca33
MD5 5c91eeb419b6fca8619bcc1e90d02f6c
BLAKE2b-256 71849d375df87f08348d1075359b0023df843a71685447b63b72bd30dd650334

See more details on using hashes here.

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