Python package for aligning embeddings and measuring alignment and stability errors.
Project description
Alignment and Stability of Embeddings
embassy: embedding alignment and stability
This Python package provides tools
- to measure alignment and stability errors of given embeddings,
- to align given embeddings.
The package will soon be updated with new functionality for extracting rotation angles of a rotation matrix, creating rotation matrices with a desired magnitude, adding random walk-based noise with a desired magnitude, and other operations.
Dependecies
Tested for numpy==1.20.1 and scipy==1.6.1 but should work with most versions.
Installation
Use the package manager pip to install embassy.
pip install embassy
Example Usage
from embassy import align_and_measure
import numpy as np
X = np.array([[1.8, 2.0], [2.3, 2.5], [ 1.8, 4.2], [4.1, 3.1]])
Y = np.array([[0.0, 1.2], [0.3, 1.6], [-0.4, 3.5 ], [1.6, 2.5]])
output = align_and_measure(X, Y)
print("\n Translation Error :", output['translation_error'],
"\n Rotation Error :", output['rotation_error'],
"\n Scale Error :", output['scale_error'],
"\n Stability Error :", output['stability_error'],
"\n",
"\n X_aligned:\n", output['emb1'],
"\n",
"\n Y_aligned:\n", output['emb2'])
See Examples/Demonstration.ipynb for visual and real-world examples.
Citation
If you find this software useful in your work, please cite:
Furkan Gursoy, Mounir Haddad, and Cecile Bothorel. (2021). "Alignment and stability of embeddings: measurement and inference improvement." (2020).
Contributing
Please feel free to open an issue for bug reports, change requests, or other contributions.
License
Packaged with: Flit
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
Hashes for embassy-0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 139ebba4cd369b78a5685fcd57cc45475a0d088645782dd8a1c34fa5be377ad5 |
|
MD5 | 1abc555ef8614509ffa3b1adeca2a5c6 |
|
BLAKE2b-256 | 6f182823e7400bac27687fa3f84377e7648f5750d2e1119d396d122d06914493 |