Skip to main content

Embedding Vector Oriented Clustering

Project description

EVōC Logo

EVōC

EVōC (pronounced as “evoke”) provides Embedding Vector Oriented Clustering. EVōC is a library for fast and flexible clustering of large datasets of high dimensional embedding vectors. If you have CLIP-vectors, outputs from sentence-transformers, or openAI, or Cohere embed, and you want to quickly get good clusters out this is the library for you. EVōC takes all the good parts of the combination of UMAP + HDBSCAN for embedding clustering, improves upon them, and removes all the time-consuming parts. By specializing directly to embedding vectors we can get good quality clustering with fewer hyper-parameters to tune and in a fraction of the time.

EVōC is the library to use if you want:

  • Fast clustering of embedding vectors on CPU

  • Multi-granularity clustering, and automatic selection of the number of clusters

  • Clustering of int8 or binary quantized embedding vectors that works out-of-the-box

As of now this is very much an early beta version of the library. Things can and will break right now. We would welcome feedback, use cases and feature suggestions however.

Basic Usage

EVōC follows the scikit-learn API, so it should be familiar to most users. You can use EVōC wherever you might have previously been using other sklearn clustering algorithms. Here is a simple example

import evoc
from sklearn.datasets import make_blobs

data, _ = make_blobs(n_samples=100_000, n_features=1024, centers=100)

clusterer = evoc.EVoC()
cluster_labels = clusterer.fit_predict(data)

Some more unique features include the generation of multiple layers of cluster granularity, the ability to extract a hierarchy of clusters across those layers, and automatic duplicate (or very near duplicate) detection.

import evoc
from sklearn.datasets import make_blobs

data, _ = make_blobs(n_samples=100_000, n_features=1024, centers=100)

clusterer = evoc.EVoC()
cluster_labels = clusterer.fit_predict(data)
cluster_layers = clusterer.cluster_layers_
hierarchy = clusterer.cluster_tree_
potential_duplicates = clusterer.duplicates_

The cluster layers are a list of cluster label vectors with the first being the finest grained and later layers being coarser grained. This is ideal for layered topic modelling and use with DataMapPlot. See this data map for an example of using these layered clusters in topic modelling (zoom in to access finer grained topics).

Installation

EVōC has a small set of dependencies:

  • numpy

  • scikit-learn

  • numba

  • tqdm

  • tbb

You can install EVōC from PyPI using pip:

pip install evoc

To install the latest version of EVōC from source:

pip install git+https://github.com/TutteInstitute/evoc.git

License

EVōC is BSD (2-clause) licensed. See the LICENSE file for details.

Contributing

Contributions are more than welcome! If you have ideas for features of projects please get in touch. Everything from code to notebooks to examples and documentation are all equally valuable so please don’t feel you can’t contribute. To contribute please fork the project make your changes and submit a pull request. We will do our best to work through any issues with you and get your code merged in.

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

evoc-0.3.0.post1.tar.gz (55.0 kB view details)

Uploaded Source

Built Distribution

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

evoc-0.3.0.post1-py3-none-any.whl (59.9 kB view details)

Uploaded Python 3

File details

Details for the file evoc-0.3.0.post1.tar.gz.

File metadata

  • Download URL: evoc-0.3.0.post1.tar.gz
  • Upload date:
  • Size: 55.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for evoc-0.3.0.post1.tar.gz
Algorithm Hash digest
SHA256 4c80d67ad3f1f0efeae9d576f986e97a53e62d1d03a4b4ece0c58ca2f9ea851e
MD5 efc9b6abc810b116a2b55d221ef2430c
BLAKE2b-256 c9a3d9d86479b711327d8d049a0b911a0c325929ea4ea1f524244f6cb98ba2a0

See more details on using hashes here.

File details

Details for the file evoc-0.3.0.post1-py3-none-any.whl.

File metadata

  • Download URL: evoc-0.3.0.post1-py3-none-any.whl
  • Upload date:
  • Size: 59.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for evoc-0.3.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 64626c409a778225978c277e4d6786293c8171c7fa3c2cd13338765ad930e183
MD5 478444613cf717968978c175c442f7bc
BLAKE2b-256 f421ec356c3041f2a2ae1e600b3241d3d783bd68886ad5df7e1ade634d2cb7da

See more details on using hashes here.

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