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 EDRep

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: edrep-0.1.2.tar.gz
  • Upload date:
  • Size: 19.5 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.2.tar.gz
Algorithm Hash digest
SHA256 014d9f2591c1032cebcf92fe3a8b9c48c4ee4e915cef61bb37fee2b416cbd1ac
MD5 a5232f08019c917a0a8241b6184cdd7c
BLAKE2b-256 4be72879dbf48db40258a231e1b09153f6195c87a3e47bb459041ae530895fae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edrep-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 790fc1ea59629841d4a5dd041b92549143133b05342a96c8cbb850a846327242
MD5 d42f40b949acfb645f0d76efd40bcc3b
BLAKE2b-256 01ecd2d153e984b8372f14895ae3f1926ead4d45d36347b9e4d5fd5f3d3060c1

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