Skip to main content

Efficient distributed representations with linear-time Softmax normalization

Project description

EDRep

Dall'Amico, Belliardo - Learning distributed representations with efficient SoftMax normalization

| Documentation | Paper |

pip install git+https://github.com/lorenzodallamico/EDRep.git

This is the Python implementation of the work presented in (Dall'Amico, Belliardo - Learning distributed representations with efficient SoftMax normalization). We propose a 2Vec-like algorithm, formulated for as a general purpose embedding problem. We consider a set of $n$ objects for which we want to obtain a distributed representation $X \in \mathbb{R}^{n\times d}$ in a $d$-dimensional Euclidean space. The algorithm requires a probability matrix $P \in \mathbb{R}^{n\times n}$ as input whose entries $P_{ij}$ are a measure of affinity between the objects $i$ and $j$. We then train the embedding vectors to approximate the input distribution described by the matrix $P$ with a variational approach based on the use of the softmax function of $XX^T$ to learn the embedding, in the spirit of 2Vec algorithms.

In (Dall'Amico, Belliardo - Learning distributed representations with efficient SoftMax normalization) we described an efficient way to estimate in $\mathcal{O}(n)$ operations the normalization constants of ${\rm SoftMax}(XX^T)$ and hence to optimize the efficiently the proposed loss function.

In our implementation, we also consider the case in which $P$ is a rectangular matrix $P\in \mathbb{R}^{n\times m}$ and two embedding matrices need to be learned: $X \in \mathbb{R}^{n\times d}, Y \in \mathbb{R}^{m\times d}$. We refer the reader to the paper and to the documentation for further details on this use case.

We refer the user to the paper and to the documentation for further details.

Requirements

We also shared an Anaconda environment in which all codes were run and tested. You can create it by running the following commands in the terminal

conda env create -f EDRep_env.yml
conda activate EDRep

Citation

If you make use of these codes, please use the following citation:

@article{
dall'amico2025learning,
title={Learning distributed representations with efficient SoftMax normalization},
author={Lorenzo Dall'Amico and Enrico Maria Belliardo},
journal={Transactions on Machine Learning Research},
issn={2835-8856},
year={2025},
url={https://openreview.net/forum?id=9M4NKMZOPu},
note={}
}

Authors

License

This software is released under the GNU AFFERO GENERAL PUBLIC LICENSE (see included file LICENSE)

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

edrep-0.1.1.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

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

edrep-0.1.1-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: edrep-0.1.1.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for edrep-0.1.1.tar.gz
Algorithm Hash digest
SHA256 41d6d667854c9e0176835e54119b9f095b1d301482e8d5de717931b568ee8748
MD5 81dbcdf88c44a269bda0bed0a5d3cc42
BLAKE2b-256 1e03247131ba56194cf6834081a0f1087a4276da1037460a802ec762d3742074

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edrep-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for edrep-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5f9c08f94bee12a67ebcd386dec33a514e435c3c67ff01c759760b9d09532378
MD5 b386ef770c4b3bc8d6f2f3dc24b4d5b1
BLAKE2b-256 5938a74ce6cda497865dad11e62f2c7d3a0568d7013deb4491527e130622b5b7

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