XMPro Vector Insight is a Python library for analyzing and visualizing embedding data. It provides tools for calculating various similarity measures (cosine, Euclidean, inner product) between embeddings and reference vectors, applying different scaling techniques, and performing basic statistical analysis on embedding data. The library is designed with flexibility in mind, allowing for easy extension and customization of its core functionalities.
Project description
XMPro Vector Insights (XMVI)
XMPro Vector Insights (XMVI) is a Python library designed for analyzing and visualizing embedding data. It provides a flexible and extensible framework for calculating similarity measures, applying scaling techniques, and performing basic statistical analysis on embedding data.
Features
- Multiple Similarity Measures: Calculate cosine, Euclidean, and inner product similarities between embeddings and reference vectors.
- Flexible Reference Vector: Use mean, median, or custom reference vectors for similarity calculations.
- Various Scaling Techniques: Apply normalization, L2 normalization, standard scaling, robust scaling, or min-max scaling to your embeddings.
- Basic Statistical Analysis: Compute mean, median, standard deviation, min, and max for your embedding data.
- Custom Function Application: Apply any custom function to your embeddings for further analysis.
- Flexible and Extensible: Easily add new similarity measures or scaling techniques.
Installation
Install XMVI using pip:
pip install xmvi
Usage
Here's a basic example of how to use XMVI:
from xmvi import EmbeddingAnalyzer, SimilarityType, ScalingType, NormalizationType
# Sample embeddings
embeddings = {
'key1': [[1, 2, 3], [4, 5, 6], [7, 8, 9]],
'key2': [[2, 3, 4], [5, 6, 7], [8, 9, 10]]
}
# Create an EmbeddingAnalyzer instance
analyzer = EmbeddingAnalyzer(embeddings)
# Calculate cosine similarity with mean as reference
cosine_sim = analyzer.calculate_similarity(SimilarityType.COSINE, 'mean')
# Scale embeddings using standard scaler
scaled_embeddings = analyzer.scale_embeddings(ScalingType.STANDARD_SCALER)
# Get basic statistics of embeddings
stats = analyzer.get_statistics()
# Apply a custom function to embeddings
squared_embeddings = analyzer.apply_function(lambda x: x**2)
print("Cosine Similarity:", cosine_sim)
print("Scaled Embeddings:", scaled_embeddings)
print("Statistics:", stats)
print("Squared Embeddings:", squared_embeddings)
Advanced Usage
Custom Reference Vector
You can use a custom reference vector for similarity calculations:
import numpy as np
custom_ref = np.array([1, 2, 3])
custom_sim = analyzer.calculate_similarity(SimilarityType.COSINE, custom_ref)
Different Normalization Types
When using normalization, you can specify the type:
normalized_embeddings = analyzer.scale_embeddings(ScalingType.NORMALIZATION, NormalizationType.L1)
Dependencies
- numpy
- scikit-learn
Contributing
We welcome contributions! Please see our contributing guidelines for more details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contact
For any queries or support, please contact [your contact information].
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xmvi-0.0.1.tar.gz.
File metadata
- Download URL: xmvi-0.0.1.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb11fc7a5ac2e0c1d1f18c90deaf599944ac3aaecf00d433a220d31acebf1b8b
|
|
| MD5 |
6b0f28fe98033512307ba02a4e4e9be7
|
|
| BLAKE2b-256 |
df152d6cbeb5c25520656da5f5e336c86213e17151759044be332b50cfca0432
|
File details
Details for the file xmvi-0.0.1-py3-none-any.whl.
File metadata
- Download URL: xmvi-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a94660a62d04a029654cbf3f61fee7b65cf53c132b3a0bb7c0bd6af6ae79bfd
|
|
| MD5 |
e5501894748aecd7fa8bc193b2f5ce06
|
|
| BLAKE2b-256 |
e275d4dac115b69d23b96412916ff391d40755c69da1ca02c0107c84225aa84d
|