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

| Paper |

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 for further details.

Installation

To install the latest version of EDRep, you can run the following command from the terminal.

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

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.0.tar.gz (19.6 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.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: edrep-0.1.0.tar.gz
  • Upload date:
  • Size: 19.6 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.0.tar.gz
Algorithm Hash digest
SHA256 0ff2e2b45d4f5422b587aa1bd09ba84a0b36f34074e0c3d2d3cc78d39b1b8462
MD5 96898cf41853c6ce15ad15388977e5d0
BLAKE2b-256 4dc18fd3f16d1a3c191a7195d52283fe2ce1daac3f1c6b9c134ccdb79ca98dc1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edrep-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.9 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae996611d270c7b63d4eb802af9fc23a96f6090a20bbb95e5a5344ac09954c2b
MD5 5caa090f1fb19e422c04290cdf2b9000
BLAKE2b-256 4535c29d63f6a2438e9831e096b84e218b3dfd993d5029bae9d87b572d37ed0c

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