Skip to main content

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

  1. numpy
  2. scipy

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

MIT

Packaged with: Flit

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

embassy-0.1.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

embassy-0.1-py2.py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 2 Python 3

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