Skip to main content

WaveSync is a Python library for nuanced, nonlinear, and rapid analysis of vectors and embeddings, tailored for RAG systems.

Project description

WaveSync is a Python library crafted for the analysis of vectors and embeddings, specifically tailored for use in Retrieval-Augmented Generation (RAG) systems.

Unlike traditional methods that rely on cosine similarity for embeddings comparison, WaveSync introduces a novel approach by employing time series decomposition and phase analysis. This method enables the library to perform a more nuanced, nonlinear, and rapid analysis of embeddings, allowing for the identification of deeper similarities and differences beyond what cosine similarity can offer.

Installation

Required Libraries

Before installing WaveSync, you have to ensure the following libraries are already installed on your system:

NumPy Badge

pip install numpy

PyWavelets Badge

pip install PyWavelets

Installation WaveSync

pip install PyWaveSync

Usage

For quick start:

from wavesync.wavesync import WaveSync
import numpy as np

vec = np.random.rand(1024)  
vecs = np.random.rand(10, 1024)

ws = WaveSync()

wavesync_scores = ws.compare(vec, vecs)

print(wavesync_scores)

If you want to see how the algorithm works on different types of vectors:

from wavesync.wavesync import WaveSync
import numpy as np

ws = WaveSync()

np.random.seed(42)  
vec = np.random.rand(1024)  
similar_vecs = [vec + np.random.normal(0, 0.01, len(vec)) for _ in range(5)]
dissimilar_vecs = [np.random.rand(len(vec)) for _ in range(5)]
vec_a = np.random.rand(1024)
vec_b = -vec_a  # Coordinate-wise opposite of vec_a

# Test with similar, dissimilar, and opposite vectors
wavesync_similar_scores = ws.compare(vec, similar_vecs)
wavesync_dissimilar_scores = ws.compare(vec, dissimilar_vecs)
wavesync_opposite_scores = ws.compare(vec_a, [vec_b])

print(wavesync_similar_scores, wavesync_dissimilar_scores, wavesync_opposite_scores)

Learn More

For those interested in diving deeper into how the WaveSync algorithm works, detailed explanations and use cases can be found on the following platforms:

  • English (Will be available in approximately 3 days): Check out our articles on Medium for an in-depth look at WaveSync.
  • Russian (Will be available in approximately 2 days): For Russian speakers, detailed discussions can be found on Habr.

Community and Contact

I'm looking forward to collaborating with anyone interested in improving WaveSync. Your feedback, suggestions, and contributions are always welcome.

How to Contribute

  • Contributions: If you'd like to contribute, start by forking the repository on GitHub. Then, create a new branch for your feature or bug fix, make your changes, and test them. When you're ready, submit a pull request with a detailed description of your work.

  • Feedback and Discussions: For comments, questions, or suggestions, please use GitHub Issues. It's a great way to provide feedback or start a conversation about the library.

Direct Contact

  • If you have specific inquiries or ideas you'd prefer to discuss directly, you can reach out to me via email at liubomir.horbatko@gmail.com. I'm always open to hearing from users and potential collaborators.

Your involvement is crucial for making WaveSync even better.

License

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

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

PyWaveSync-0.1.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

PyWaveSync-0.1.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file PyWaveSync-0.1.1.tar.gz.

File metadata

  • Download URL: PyWaveSync-0.1.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for PyWaveSync-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b15310402c0d6e38dbf6bc9d6f6f39af6c81dae9392db0235cc8cf4049e19f69
MD5 ab6487a022a79a741b83b88b9ba4b856
BLAKE2b-256 b9e95cee768f4bb7c62c08be143fc4f55607966a2a13ecc064ee1fa1a333b44b

See more details on using hashes here.

File details

Details for the file PyWaveSync-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: PyWaveSync-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.0

File hashes

Hashes for PyWaveSync-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 95a63ec9b654dc100f9cd91c04966da1b75f04917cf0d787654a405ab41a927a
MD5 df6b268f8f82453745d4f2d4a20c931e
BLAKE2b-256 7b1473da677875143fff8b3f30871173e67b0022b8958cb84642314d6be96f55

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