Skip to content

pyt-team/TopoEmbedX

Repository files navigation

Lint Lint Codecov Python DOI

pyt

toponetx

🌐 TopoEmbedX (TEX) 🍩

Representation Learning on Topological Domains

topoembedx

Many natural systems as diverse as social networks and proteins are characterized by relational structure. This is the structure of interactions between components in the system, such as social interactions between individuals or electrostatic interactions between atoms.

How can we conveniently represent data defined on such relational systems?

TopoEmbedX (TEX) is a package for representation learning on topological domains, the mathematical structures of relational systems.

🛠️ Main Features in Version 1.0

Support of higher order representation learning algorithms such as:

  • DeepCell,
  • Cell2Vec,
  • Higher Order Laplacian Eigenmaps, and
  • Higher Order Geometric Laplacian Eigenmaps

for the topological domains supported in TopoNetX.

🤖 Installing TopoEmbedX

We recommend using Python 3.11, which is a python version used to run the unit-tests.

For example, create a conda environment:

conda create -n tex python=3.11.3
conda activate tex

Then:

  1. Clone a copy of TopoEmbedX from source:
git clone https://github.com/pyt-team/TopoEmbedX
cd TopoEmbedX
  1. If you have already cloned TopoEmbedX from source, update it:
git pull
  1. Install TopoEmbedX in editable mode:
pip install -e '.[all]'
  1. Install pre-commit hooks:
pre-commit install

🦾 Getting Started

import topoembedx as tex
import toponetx as tnx

# create a cell complex object with a few cells
cc = tnx.classes.CellComplex([[1, 2, 3, 4], [3, 4, 5, 6, 7, 8]],ranks=2)

# create a model

model = tex.Cell2Vec()

# fit the model

model.fit(cc, neighborhood_type="adj", neighborhood_dim={"rank": 1, "via_rank": -1})
# here neighborhood_dim={"rank": 1, "via_rank": -1} specifies the dimension for
# which the cell embeddings are going to be computed.
# rank=1 means that the embeddings will be computed for the first dimension.
# The integer 'via_rank' is ignored and only considered
# when the input complex is a combinatorial complex or colored hypergraph.


# get the embeddings:

embeddings = model.get_embedding()

🔍 References

To learn more about topological representation learning.

  • Mustafa Hajij, Ghada Zamzmi, Theodore Papamarkou, Nina Miolane, Aldo Guzmán-Sáenz, Karthikeyan Natesan Ramamurthy, Tolga Birdal, Tamal K. Dey, Soham Mukherjee, Shreyas N. Samaga, Neal Livesay, Robin Walters, Paul Rosen, Michael T. Schaub. Topological Deep Learning: Going Beyond Graph Data.
@misc{hajij2023topological,
      title={Topological Deep Learning: Going Beyond Graph Data},
      author={Mustafa Hajij and Ghada Zamzmi and Theodore Papamarkou and Nina Miolane and Aldo Guzmán-Sáenz and Karthikeyan Natesan Ramamurthy and Tolga Birdal and Tamal K. Dey and Soham Mukherjee and Shreyas N. Samaga and Neal Livesay and Robin Walters and Paul Rosen and Michael T. Schaub},
      year={2023},
      eprint={2206.00606},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}

Figure from:

@misc{papillon2023architectures,
      title={Architectures of Topological Deep Learning: A Survey on Topological Neural Networks},
      author={Mathilde Papillon and Sophia Sanborn and Mustafa Hajij and Nina Miolane},
      year={2023},
      eprint={2304.10031},
      archivePrefix={arXiv},
      primaryClass={cs.LG}
}