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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

Details for the file embassy-0.1.tar.gz.

File metadata

  • Download URL: embassy-0.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for embassy-0.1.tar.gz
Algorithm Hash digest
SHA256 022b04cb3b2bb0977f9f555c3ffc6cbabfde07ba039d442f7c7fad6e020bb2b3
MD5 223423fe1002601345f84126bd81d959
BLAKE2b-256 a817f9c9de815952bde79b06364034876723fd44753167366c2fccc80b7a6b87

See more details on using hashes here.

File details

Details for the file embassy-0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: embassy-0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.25.1

File hashes

Hashes for embassy-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 139ebba4cd369b78a5685fcd57cc45475a0d088645782dd8a1c34fa5be377ad5
MD5 1abc555ef8614509ffa3b1adeca2a5c6
BLAKE2b-256 6f182823e7400bac27687fa3f84377e7648f5750d2e1119d396d122d06914493

See more details on using hashes here.

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