pyt-team / topomodelx Goto Github PK
View Code? Open in Web Editor NEWTopological Deep Learning
License: MIT License
Topological Deep Learning
License: MIT License
TopoModelX contains some scatter functions in utils.scatter
, that -- according to the module docstring -- are adapted from torch_scatter
. Is there a specific reason why we ship our own implementation? torch_scatter
is a dependency already.
If yes, we should document that reason and how the build-in implementation differs from torch_scatter
(which, for me, is not at all obvious from looking at the code). Otherwise remove it and use the existing implementation in torch_scatter
everywhere.
The bug happens when the last cell / simplex (index-wise) is isolated. Simple code to reproduce the issue:
from toponetx.classes.cell_complex import CellComplex
import torch
from topomodelx.base.conv import Conv
if __name__ == '__main__':
complex = CellComplex()
complex.add_cell([0,1,2], 2)
complex.add_cell([0,1,3], 2)
complex.add_node(4)
vertex_feats = torch.zeros(5, 3)
hidden_dim = 8
A0 = torch.from_numpy(complex.adjacency_matrix(rank=0).todense()).to_sparse().float()
conv_0_to_0 = Conv(
in_channels=in_channels_0, out_channels=in_channels_0, att=False
)
zv = conv_0_to_0(vertex_feats, A0)
While Dist2CycleLayer
s are correctly constructed in Dist2Cyle
, they are never actually called.
forward
method.Hello,
In MessagePassing::forward
, it's stated that the shape of return value is [..., n_target_cells, out_channels]
but its return value is actually of shape [..., n_target_cells_with_neighbors, out_channels]
which its last but one dimension size is the number of target cells that have any neighbor in source cells. Which one is supposed to be correct? The implementation or the docstring?
To reproduce:
from topomodelx.base.message_passing import MessagePassing
m = MessagePassing()
x_source = torch.rand((3,10))
neighborhood = torch.tensor([[1, 0, 1], [0, 0, 0]]).to_sparse_coo()
m.forward(x_source, neighborhood).shape # result: torch.Size([1, 10])
What:
Setup instructions in Readme do not explicitly install torch-cluster (for. eg. if torch installation is done for cpu), need to ensure torch-cluster is also separately installed as pytest fails with missing module error if torch-cluster is not installed.
Extends existing algorithms in TopoEmbedX to ColoredHyperGraph and PathComplex
TopoEmbedX can support all compelxes that TopoNetX implements. Currently, only cell, simplicial and combintorial complexes are supported in the algorithms.
Most work needs to be done here in the neighborhood file :
https://github.com/pyt-team/TopoEmbedX/blob/main/topoembedx/neighborhood.py
to extends its functionalities to ColoredHyperGraph and PathComplex.
I have a couple of questions/found bugs regarding the HSN tutorial (and hence might impact other tutorials in the simplicial domain).
self.layers = torch.nn.ModuleList(layers)
, so that the parameters get properly registered.softmax
, as later binary crossentropy on logits is used:
The tutorials webpage of TopoModelX documentation website does not display any thumbnails.
https://pyt-team.github.io/topomodelx/tutorials/index.html
We should add thumbnails.
The tutorials webpage is one of the first pages that users see. It should look clean.
Additionally, thumbnails help the reader understanding what the tutorials are about.
In order to add thumbnails, we refer to the similar github issue that added thumbnails for the tutorials of TopoNetX:
pyt-team/TopoNetX#84
The PR solving the issue was:
pyt-team/TopoNetX#179
The persons solving the issue were: @devendragovil and @mhajij: ask them for guidelines if needed.
For each tutorial notebook:
Hi,
From looking at the existing tutorials for cell based networks, it doesnt seem like there is a convention to do batching for cell complexes. Is there some sort of best practice established within the TopoModelX framework? How should I go about creating batches?
We consider the neural networks (not the layers, the full networks) implemented for the simplicial domain. These neural networks are currently implemented as Python classes in the tutorials notebooks.
We should, instead, port their implementation into the core code base, specifically into: topomodelx/nn/simplicial/
.
The neural networks are "hidden" in the tutorials.
They might also be less unit-tested than what they could be if they were inside the core codebase.
The files to modify are:
NOTE: This issue only focus on layers within the simplicial domain. There will be other issues to port the neural network python code into the core code base for the other domains.
For each file tutorials/simplicial/[model-name]_train.ipynb
:
topomodelx/nn/simplicial/[model-name].py
(note the absence of any _layer
suffix).test/nn/simplicial/test_[model-name].py
(note the absence of any _layer
suffix).This is the list of essentials that need to be checked before submitting the software paper.
JMLR guidelines: https://www.jmlr.org/mloss/mloss-info.html
They state, for example: "It is expected that test coverage is close to 100%."
We consider the layers implemented for the simplicial complex domain, i.e. the ones in nn/simplicial/*_layer.py
.
Each Layer is a Python class that has a forward() method.
The docstring of this forward method should give the message passing equation of the Layer that is being implemented.
For example, see how the docstring of the forward method of the HSNLayer here:
properly gives the equations:
r"""Forward pass.
The forward pass was initially proposed in [HRGZ22]_.
Its equations are given in [TNN23]_ and graphically illustrated in [PSHM23]_.
.. math::
\begin{align*}
&๐ฅ \quad m_{{y \rightarrow z}}^{(0 \rightarrow 0)} = \sigma ((A_{\uparrow,0})_{xy} \cdot h^{t,(0)}_y \cdot \Theta^{t,(0)1})\\
&๐ฅ \quad m_{z \rightarrow x}^{(0 \rightarrow 0)} = (A_{\uparrow,0})_{xy} \cdot m_{y \rightarrow z}^{(0 \rightarrow 0)} \cdot \Theta^{t,(0)2}\\
&๐ฅ \quad m_{{y \rightarrow z}}^{(0 \rightarrow 1)} = \sigma((B_1^T)_{zy} \cdot h_y^{t,(0)} \cdot \Theta^{t,(0 \rightarrow 1)})\\
&๐ฅ \quad m_{z \rightarrow x)}^{(1 \rightarrow 0)} = (B_1)_{xz} \cdot m_{z \rightarrow x}^{(0 \rightarrow 1)} \cdot \Theta^{t, (1 \rightarrow 0)}\\
&๐ง \quad m_{x}^{(0 \rightarrow 0)} = \sum_{z \in \mathcal{L}_\uparrow(x)} m_{z \rightarrow x}^{(0 \rightarrow 0)}\\
&๐ง \quad m_{x}^{(1 \rightarrow 0)} = \sum_{z \in \mathcal{C}(x)} m_{z \rightarrow x}^{(1 \rightarrow 0)}\\
&๐ฉ \quad m_x^{(0)} = m_x^{(0 \rightarrow 0)} + m_x^{(1 \rightarrow 0)}\\
&๐ฆ \quad h_x^{t+1,(0)} = I(m_x^{(0)})
\end{align*}
However, some forward functions of the layers on the simplicial domain do not provide the mathematical equations associated with this message passing. We should add them.
The code is easier to read and understand if one can refer to the mathematical equation directly.
While the equation does not render very well in the docstring, it will render on the documentation website which will help the users.
The files to modify are:
NOTE: This issue only focus on layers within the simplicial domain. There will be other issues to add equations in docstrings for other topological domains.
Go to the repository: https://github.com/awesome-tnns/awesome-tnns
Go to the file: Simplicial_Complexes.md
For each layer file simplicial/*_layer.py, for each forward() method in that file:
Simplicial_Complexes.md
.Note: this last step might need to wait on the issue #165
There were two implementations of SCN by challenge participants:
However, we should check that the difference between these two implementations only lies in the ranks used.
Because it is confusing to have two very close implementations of SCN without knowing their precise difference.
The files to modify are:
We should look at the following:
We consider the neural networks (not the layers, the full networks) implemented for the hypergraph domain. These neural networks are currently implemented as Python classes in the tutorials notebooks.
We should, instead, port their implementation into the core code base, specifically into: topomodelx/nn/hypergraph/
.
The neural networks are "hidden" in the tutorials.
They might also be less unit-tested than what they could be if they were inside the core codebase.
The files to modify are:
NOTE: This issue only focus on layers within the hypergraph domain. There will be other issues to port the neural network python code into the core code base for the other domains.
For each file tutorials/hypergraph/[model-name]_train.ipynb
:
topomodelx/nn/hypergraph/[model-name].py
(note the absence of any _layer
suffix).test/nn/hypergraph/test_[model-name].py
(note the absence of any _layer
suffix).I am trying to perform matrix multiplication in the _MessagePassing class as a test case.
import torch
import numpy as np
import topomodelx as tmx
import toponetx as tnx
from topomodelx.nn.base import _MessagePassing
def coo_2_torch_tensor(sparse_mx, sparse=True):
"""Convert a scipy matrix to a torch tensor.
Parameters
----------
sparse_mx : scipy matrix
Matrix to convert.
sparse: bool
Specifies if the matrix is sparse or not.
Returns
-------
_ : torch.tensor
Converted matrix.
"""
if sparse:
sparse_mx = sparse_mx.tocoo().astype(np.float32)
indices = torch.from_numpy(
np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64)
)
values = torch.from_numpy(sparse_mx.data)
shape = torch.Size(sparse_mx.shape)
return torch.sparse.FloatTensor(indices, values, shape)
return torch.FloatTensor(sparse_mx.todense())
SC= tnx.SimplicialComplex([[0,1],[1,2]])
B1 = coo_2_torch_tensor(SC.incidence_matrix(1))
mp = _MessagePassing(1,1)
x_e = torch.rand(2,10)
x_v = mp (x_e,B1)
getting the error:
TypeError: 'module' object is not callable
I have a couple of clarifying questions about cellular attention networks and the code for the attention mechanism in the conv and message passing files.
Across the three packages, the code is not consistent in its use of Typing. Sometimes we have typing, sometimes we do not.
We should decide on one convention and stick to it. If we decide to include Typing, then we should check it with mypy.
The addition of Typing in the CI workflow can be done like this:
pyt-team/TopoNetX#163
Adding typing help debug the code.
Everywhere: in the code base of all repositories of pyt-team.
In the code:
There is an issue upon loading the datasets from TopoNetX when testing TopoModelX through GitHub Actions.
See details:
pyt-team/TopoNetX#195
We need to fix it.
Because the merge of TopoModelX's PR 98 is blocked by this:
#98
This PR has the implementation of the SNN model.
On TopoModelX, this might mean modifying the github workflow file for tests, which is:
.github/workflows/test.yml
On TopoNetX, this might mean modifying how the datasets are loaded.
Many tutorials manage to load and compute with datasets from TopoNetX. Get inspiration from this code and fix the dataset that is not working for the SNN PR 98.
I get:
Python 3.10.10 (main, Mar 21 2023, 13:41:39) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import torch_scatter
libc++abi: terminating with uncaught exception of type std::length_error: vector
Abort trap: 6
See TODO's in overleaf
We consider the neural networks (not the layers, the full networks) implemented for the cell domain. These neural networks are currently implemented as Python classes in the tutorials notebooks.
We should, instead, port their implementation into the core code base, specifically into: topomodelx/nn/cell/
.
The neural networks are "hidden" in the tutorials.
They might also be less unit-tested than what they could be if they were inside the core codebase.
The files to modify are:
NOTE: This issue only focus on layers within the cell domain. There will be other issues to port the neural network python code into the core code base for the other domains.
For each file tutorials/cell/[model-name]_train.ipynb
:
topomodelx/nn/cell/[model-name].py
(note the absence of any _layer
suffix).test/nn/cell/test_[model-name].py
(note the absence of any _layer
suffix).The Tutorials Tab of TopoModelX's documentation website does not display the tutorials properly.
https://pyt-team.github.io/topomodelx/tutorials/index.html
Specifically, the headers of every tutorials shows up which clutters the page without providing any useful information:
Tutorials
[Train a Cellular Attention Network (CAN)](https://pyt-team.github.io/topomodelx/notebooks/cell/can_train.html)
[Set-up](https://pyt-team.github.io/topomodelx/notebooks/cell/can_train.html#Set-up)
[Pre-processing](https://pyt-team.github.io/topomodelx/notebooks/cell/can_train.html#Pre-processing)
[Create the Neural Network](https://pyt-team.github.io/topomodelx/notebooks/cell/can_train.html#Create-the-Neural-Network)
[Train the Neural Network](https://pyt-team.github.io/topomodelx/notebooks/cell/can_train.html#Train-the-Neural-Network)
[Train the Neural Network with Attention](https://pyt-team.github.io/topomodelx/notebooks/cell/can_train.html#Train-the-Neural-Network-with-Attention)
[Train a Convolutional Cell Complex Network (CCXN)](https://pyt-team.github.io/topomodelx/notebooks/cell/ccxn_train.html)
[Set-up](https://pyt-team.github.io/topomodelx/notebooks/cell/ccxn_train.html#Set-up)
Etc...
We need to prevent these headers to appear, so that only the thumbnails of the tutorials are shown.
Because displaying headers of tutorials does not provide any useful information and clutters the page.
On TopoModelX, modify the documentation website's "tutorials" tab by modifying:
https://github.com/pyt-team/TopoModelX/tree/main/docs/tutorials
Maybe the :maxdepth: 1
parameter can be tuned?
The API Reference Tab of TopoModelX's documentation website is broken.
https://pyt-team.github.io/topomodelx/api/index.html
It is broken because it does not show the Python classes and functions, and their docs, that are implemented in the package.
By contrast, the API Reference Tab of TopoNetX is not broken (at least at the time of submission of this issue), and looks like this:
https://pyt-team.github.io/toponetx/api/index.html
(see also Screenshot below, in the case the API Reference Tab of TopoNetX does break after this issue is submitted).
We need to fix the API Reference Tab of TopoModelX.
Because the API Reference is one of the most important aspect of the documentation website. It needs to show which functions are implemented in the package.
On TopoModelX, modify the documentation website's "api" tab by modifying files in the folder:
https://github.com/pyt-team/TopoModelX/tree/main/docs/api
Look at how the API Reference Tab is coded in TopoNetX, by looking at the files in this folder:
https://github.com/pyt-team/TopoNetX/tree/main/docs/api
Detect what differs between TopoModelX and TopoNetX, and fix TopoModelX accordingly.
The main difference is probably that TopoModelX has an additional layer of folder structure, that needs to be correctly processed.
Two Issues:
Please guide me regarding the location of thumbnails for the docs. Alternatively, will be helpful if I can get guidance on which images can serve as thumbnails.
Testing the tutorials on hypergraphs takes ~15 minutes, whereas testing the tutorials on other domains takes ~2-5 minutes (see screenshot).
There is probably one tutorial on hypergraphs that takes very long and slows down the whole github action workflow.
Find out which one and whether it can be accelerated.
A slow testing workflow slows down all the contributors, who have to wait for all tests to pass before being able to move on.
There were two implementations of Scone by challenge participants.
If they are indeed the same implementation, we need to merge them into 3 files:
If they are different implementations, we need to check if one of them can be deleted.
Possible reasons to delete:
If we decide to keep both of them, the file names and docstrings should be updated to highlight their difference.
Because it is confusing to have two implementations of Scone without knowing their difference.
The files to modify are:
See for example how the duplicate SCN and SCN2 has been solved and the use of the "See Also" sections in their docstrings.
Make three figures for the software paper in overleaf. See overleaf.
Some docstrings are erroneous, for example:
class SCNN(torch.nn.Module):
"""Simplicial convolutional neural network implementation for complex classification.
Note: At the last layer, we obtain the output on simplcies, e.g., edges.
To perform the complex classification task for this challenge, we consider pass the final output to a linear layer and compute the average.
Parameters
----------
in_channels: int
Dimension of input features
intermediate_channels: int
Dimension of features of intermediate layers
out_channels: int
Dimension of output features
conv_order_down: int
Order of lower convolution
conv_order_up: int
Order of upper convolution
n_layers: int
Numer of layers
"""
def __init__(
self,
in_channels,
intermediate_channels,
out_channels,
conv_order_down,
conv_order_up,
aggr_norm=False,
update_func=None,
n_layers=2,
):
Check docstrings in the whole codebase and correct them if needed. Check that:
Follow docstrings' guidelines written in our contribution file: https://pyt-team.github.io/topomodelx/contributing/index.html#write-documentation
There were two implementations of HNHN by challenge participants.
If they are indeed the same implementation, we need to merge them into 3 files:
If they are different implementations, we need to check if one of them can be deleted.
Possible reasons to delete:
If we decide to keep both of them, the file names and docstrings should be updated to highlight their difference.
Because it is confusing to have two implementations of HNHN without knowing their difference.
The files to modify are:
See for example how the duplicate SCN and SCN2 has been solved and the use of the "See Also" sections in their docstrings.
We consider the layers implemented for the hypergraph domain, i.e. the ones in nn/hypergraph/*_layer.py
.
Each Layer is a Python class that has a forward() method.
The docstring of this forward method should give the message passing equation of the Layer that is being implemented.
For example, see how the docstring of the forward method of the UniGCNII here:
https://github.com/pyt-team/TopoModelX/blob/main/topomodelx/nn/hypergraph/unigcnii_layer.py
properly gives the equations:
The forward pass consists of:
- two messages, and
- a skip connection with a learned update function.
1. Every hyper-edge sums up the features of its constituent edges:
.. math::
\begin{align*}
& ๐ฅ \quad m_{y \rightarrow z}^{(0 \rightarrow 1)} = (B^T_1)\_{zy} \cdot h^{t,(0)}_y \\
& ๐ง \quad m_z^{(0\rightarrow1)} = \sum_{y \in \mathcal{B}(z)} m_{y \rightarrow z}^{(0 \rightarrow 1)}
\end{align*}
2. The second message is normalized with the node and edge degrees:
.. math::
\begin{align*}
& ๐ฅ \quad m_{z \rightarrow x}^{(1 \rightarrow 0)} = B_1 \cdot m_z^{(0 \rightarrow 1)} \\
& ๐ง \quad m_{x}^{(1\rightarrow0)} = \frac{1}{\sqrt{d_x}}\sum_{z \in \mathcal{C}(x)} \frac{1}{\sqrt{d_z}}m_{z \rightarrow x}^{(1\rightarrow0)} \\
\end{align*}
3. The computed message is combined with skip connections and a linear transformation using hyperparameters alpha and beta:
.. math::
\begin{align*}
& ๐ฉ \quad m_x^{(0)} = m_x^{(1 \rightarrow 0)} \\
& ๐ฆ \quad m_x^{(0)} = ((1-\beta)I + \beta W)((1-\alpha)m_x^{(0)} + \alpha \cdot h_x^{t,(0)}) \\
\end{align*}
However, some forward functions of the layers on the hypergraph domain do not provide the mathematical equations associated with this message passing. We should add them.
The code is easier to read and understand if one can refer to the mathematical equation directly.
While the equation does not render very well in the docstring, it will render on the documentation website which will help the users.
The files to modify are:
NOTE: This issue only focus on layers within the hypergraph domain. There will be other issues to add equations in docstrings for other topological domains.
Go to the repository: https://github.com/awesome-tnns/awesome-tnns
Go to the file: Hypergraphs.md
For each layer file hypergraph/*_layer.py, for each forward() method in that file:
Hypergraphs.md
.Note: this last step might need to wait on the issue #165.
Some simplicial(/cellular) complex layers are applicable to complexes of arbitrary high rank. This raises the question of how the input to these layers should be formatted.
In #129 we use a dictionary each for adjacencies, incidences and features, indexing each adjacency/incidence/feature matrix by their rank. In #142 lists are used instead. I must admit that I have not carefully checked all implementations to see if there are more examples. Perhaps neither of these solutions is robust enough and there should be some custom data structure for a complex, something like an analogue to the SimplicialComplex
class in TopoNetX but using PyTorch instead of NumPy?
In any case it would be good to synchronize the implementations, so I started this issue for discussing!
Write coverletter that accompanies the software paper for JMLR software track. We need one.
Guidelines about what to put in the coverletter can be found here: https://www.jmlr.org/mloss/mloss-info.html
Nina shared a template of cover letter on overleaf in the slack channel for the software paper. it has text that should be adapted.
Implement a path complex neural network.
Currently TopoModelX has networks for hypergraphs, simp, cell and combinatorial complexes. TopoNetX supports all these complexes as well as Path Complex, yet the package does not have any neural networks build for path complexes.
Follow the templates we have for other networks, add layer and network classes. Add a tutorial in the tutorial folder under path folder, add unit tests.
Notebooks often use a sparse -> dense -> sparse conversion, e.g. sccnn_train.ipynb
laplacian_0 = torch.from_numpy(laplacian_0.todense()).to_sparse()
This is inefficient: it makes our tutorials, and therefore our unit-tests slower.
The sparse numpy array should be directly transformed into a sparse tensor, e.g. using torch.sparse_coo_tensor.
pip install -e ".[dev,full]"
Gives:
Obtaining file:///Volumes/GoogleDrive/My%20Drive/code/TopoModelX
Preparing metadata (setup.py) ... done
Collecting toponetx@ git+https://[email protected]/pyt-team/TopoNetX.git
Cloning https://****@github.com/pyt-team/TopoNetX.git to /private/var/folders/dz/k1hb2xr94k558sjs416njdp40000gn/T/pip-install-wwfbzseq/toponetx_ccc12cc924f6461eb2b665372872af30
Running command git clone --filter=blob:none --quiet 'https://****@github.com/pyt-team/TopoNetX.git' /private/var/folders/dz/k1hb2xr94k558sjs416njdp40000gn/T/pip-install-wwfbzseq/toponetx_ccc12cc924f6461eb2b665372872af30
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/pyt-team/TopoNetX.git/'
error: subprocess-exited-with-error
ร git clone --filter=blob:none --quiet 'https://****@github.com/pyt-team/TopoNetX.git' /private/var/folders/dz/k1hb2xr94k558sjs416njdp40000gn/T/pip-install-wwfbzseq/toponetx_ccc12cc924f6461eb2b665372872af30 did not run successfully.
โ exit code: 128
โฐโ> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
ร git clone --filter=blob:none --quiet 'https://****@github.com/pyt-team/TopoNetX.git' /private/var/folders/dz/k1hb2xr94k558sjs416njdp40000gn/T/pip-install-wwfbzseq/toponetx_ccc12cc924f6461eb2b665372872af30 did not run successfully.
โ exit code: 128
โฐโ> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
There were two implementations of HOAN models from Hajij 22a by challenge participants, in the PRs:
https://github.com/pyt-team/TopoModelX/pull/145/files
https://github.com/pyt-team/TopoModelX/pull/104/files
Both PRs fail the unit-tests.
It is also unclear whether the PRs implement the same HOAN model, or different models from Hajij22a.
If they are implementing the same HOAN model, we need to merge them into 3 files:
If they are different implementations, we need to check if one of them can be deleted.
Possible reasons to delete:
If we decide to keep both of them, the file names and docstrings should be updated to highlight their difference.
These PRs represent our only implementation of the combinatorial_complex
domain which is currently not represented in topomodelx. We need to merge them so that this domain is represented as well.
The files to add should look like:
If the two PRs are actually implementing different models, then we should have 2 sets of 3-files (one set for each model) with explicit names and documentation that reflect the differences between the models.
See for example how the duplicate SCN and SCN2 has been solved and the use of the "See Also" sections in their docstrings.
There were two implementations of CAN by challenge participants.
If they are indeed the same implementation, we need to merge them into 3 files:
If they are different implementations, we need to check if one of them can be deleted.
Possible reasons to delete:
If we decide to keep both of them, the file names and docstrings should be updated to highlight their difference.
Because it is confusing to have two implementations of CAN without knowing their difference.
The files to modify are:
See for example how the duplicate SCN and SCN2 has been solved and the use of the "See Also" sections in their docstrings.
Additionally:
_v2
in can_layer.py
because:# Some notes - The attention function provided for us does not normalize the attention coefficients. Should this be done?
# Where should we be able to customize the non-linearities? Seems important for the output. What about the attention non-linearities do we just use what is given?
# I wanted to make this so that without attention it ends up being the Hodge Laplacian network. Maybe ask the contest organizers about this?
The docstrings of several functions have a Reference section that looks like:
References
----------
.. [AGRW20] Devanshu Arya, Deepak K Gupta, Stevan Rudinac and Marcel Worring.
HyperSAGE: Generalizing inductive representation learning on hypergraphs.
arXiv preprint arXiv:2010.04558. 2020
Within the docstrings, the papers are cited via in [AGRW20]
or maybe via in _[AGRW20]
(using an underscore?).
We should make sure that each docstring:
Note: this issue is blocking on Issue , which should be completed first.
Because we want to give credit to the authors of the corresponding papers.
Because it will help the users of the codebase to know in which paper they can find the theory corresponding to the code they are trying to run.
Everywhere.
Check on the documentation website that the references look great by going to:
https://pyt-team.github.io/topomodelx/api/index.html
The current documentation website does not include TMX.
We should add one to help contributors navigate the repository.
The documentation website is a great entry point for contributors.
Add API documentation pages in here:
https://github.com/pyt-team/TopoModelX/tree/main/docs
If necessary, change the docs workflow:
.github/workflows/docs.yml
The API should be automatically generated from the code. Follow what was done for TNX.
Create a pyt-team website that serves as a single entry point that points towards the three documentation websites.
Users might want to circulate from one doc website to the other. Having one single entry point could help.
Create a docs folder with the content of the website. See /docs folder in the PR referenced below.
Create a github action workflow that builds and deploys the content of the docs folder into a website. See .github/workflow/docs.yml in the PR referenced below.
Use Pyt-Team image as a welcome banner.
Make sure that the formatting of the website is intact.
On each package's doc website, create an option to go to the others: e.g. on TopoNetX's website, create an option to go to TopoEmbedX and TopoModelX, etc.
Unfinished PRs can't be easily flagged right now. Pull Request Drafts require a public Repository, GitHub Team, GitHub Enterprise Server 2.17+ or GitHub Enterprise Cloud.
Can we somehow simplify the linting process? It seems like the current setup could create a entry barrier, because while black passes, flake8 sometimes doesn't and so you have to format manually.
trying to run the code:
import topomodelx as tmx
from topomodelx.nn.base import _MessagePassing
from topomodelx.nn.conv import MessagePassingConv
import toponetx as tnx
import torch
import numpy as np
def coo_2_torch_tensor(sparse_mx, sparse=True):
"""Convert a scipy matrix to a torch tensor.
Parameters
----------
sparse_mx : scipy matrix
Matrix to convert.
sparse: bool
Specifies if the matrix is sparse or not.
Returns
-------
_ : torch.tensor
Converted matrix.
"""
if sparse:
sparse_mx = sparse_mx.tocoo().astype(np.float32)
indices = torch.from_numpy(
np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64)
)
values = torch.from_numpy(sparse_mx.data)
shape = torch.Size(sparse_mx.shape)
return torch.sparse.FloatTensor(indices, values, shape)
return torch.FloatTensor(sparse_mx.todense())
SC= tnx.SimplicialComplex([[0,1],[1,2]])
B1 = coo_2_torch_tensor(SC.incidence_matrix(1))
x_e = torch.rand(2,10)
model = MessagePassingConv(10,10)
xv = model(x_e,B1)
but I am getting the error :
AttributeError: 'MessagePassingConv' object has no attribute 'weight'
weights are not defined in the class MessagePassingConv
Provide a structure of Python classes that inherit from torch.nn.Module and that allow future contributors to implement the architecture of topological deep learning in a consistent framework.
Provide example notebooks.
Provide unit-tests.
The current dev implementation is not tested, and does not follow a consistent API. We need to have a consistent, unit-tested and documented code architecture before asking contributors to contribute their models or develop new models.
In the repo topomodelx, follow a structure of folders that is inspired by torch_geometric.
From the literature:
Once these tasks are done with unit-tested, documented code, the package is available for large-scale contributions.
Hi!
In test_reset_parameters()
HSNLayer
modules are checked to be instances of torch.nn.Conv2d
. However, none of them are, since the layer consists of only Aggregation
(from topomodelx.base.aggregation
) and Conv
from (topomodelx.base.conv
).
Thus, the test will be passed without actually checking the parameter reset.
(The test itself is incorrect: after resetting, the parameters of a torch.nn.Conv2d
layer are compared to zeros
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.