Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign lifting maps #116

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0863fc4
Add initial redesign of liftings maps
luisfpereira Nov 25, 2024
e5ee0f3
Rename Complex and move propagate_values to projection sum feature li…
luisfpereira Dec 6, 2024
55b4120
Rename adapters
luisfpereira Dec 6, 2024
8c146f2
Move Complex and adapters to data utils
luisfpereira Dec 6, 2024
59051c6
Update imports
luisfpereira Dec 25, 2024
f05aac4
Merge branch 'main' into lifting-map
luisfpereira Dec 25, 2024
e4165d8
Update SimplicialKHopLifting to work with new design
luisfpereira Jan 15, 2025
2777f9b
Add IdentityAdapter as default for all the adaptations in the Lifting…
luisfpereira Jan 15, 2025
e5d48d3
Improve TnxComplex2Complex api and signatures; improve variable naming
luisfpereira Jan 15, 2025
601a0e1
Update graph2hypergraph liftings to work with new design
luisfpereira Jan 15, 2025
1f9b12d
Update graph2cell liftings to work with new design
luisfpereira Jan 15, 2025
f560475
Improve SimplicialCliqueLifting docstrings
luisfpereira Jan 15, 2025
cfd7f45
Fix lifting tests (NB: same behavior, only adapted setup - with few e…
luisfpereira Jan 15, 2025
5ac166f
Remove dead code
luisfpereira Jan 15, 2025
305f486
Update TRANSFORMS automatically dict creation/imports
luisfpereira Jan 16, 2025
f77ad64
Fix handling of empty matrices due to inexisting dimension
luisfpereira Jan 16, 2025
0668f97
Update feature liftings due to new design
luisfpereira Jan 16, 2025
190e2b8
Add str-based instantiation to LiftingMap for backwards compatibility
luisfpereira Jan 16, 2025
f774c97
Fix Data2NxGraph adapter
luisfpereira Jan 16, 2025
bd24387
Fix failing data manipulation test (only setup)
luisfpereira Jan 16, 2025
a7a8755
Fix TnxComplex2Complex adapter to handle CellComplex features
luisfpereira Jan 16, 2025
2ccbea3
Add syntax sugar to instantiate graph2complex/simplicial lifting tran…
luisfpereira Jan 16, 2025
7682fef
Make imports shorter and use newly added syntax sugar
luisfpereira Jan 16, 2025
f3e3f88
Update domain to accomodate hypergraph data
luisfpereira Jan 16, 2025
f4010fa
Update data_transform to handle new liftings design
luisfpereira Jan 16, 2025
27962fc
Fix failing tests
luisfpereira Jan 16, 2025
1f5ad56
Fix tutorial_lifting
luisfpereira Jan 17, 2025
81df9ac
Remove use of lambda func
luisfpereira Jan 17, 2025
7e7a49b
Merge branch 'main' into lifting-map
luisfpereira Jan 21, 2025
4f10f7b
Bump codecov to v5
luisfpereira Jan 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
pytest --cov --cov-report=xml:coverage.xml test/

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
Expand Down
54 changes: 28 additions & 26 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
"""Configuration file for pytest."""

import networkx as nx
import pytest
import torch
import torch_geometric
from topobenchmark.transforms.liftings.graph2simplicial import (
SimplicialCliqueLifting
)
from topobenchmark.transforms.liftings.graph2cell import (
CellCycleLifting

from topobenchmark.transforms.liftings import (
CellCycleLifting,
Graph2CellLiftingTransform,
Graph2SimplicialLiftingTransform,
SimplicialCliqueLifting,
)


@pytest.fixture
def mocker_fixture(mocker):
"""Return pytest mocker, used when one want to use mocker in setup_method.

Parameters
----------
mocker : pytest_mock.plugin.MockerFixture
A pytest mocker.

Returns
-------
pytest_mock.plugin.MockerFixture
Expand All @@ -31,7 +33,7 @@ def mocker_fixture(mocker):
@pytest.fixture
def simple_graph_0():
"""Create a manual graph for testing purposes.

Returns
-------
torch_geometric.data.Data
Expand Down Expand Up @@ -74,10 +76,11 @@ def simple_graph_0():
)
return data


@pytest.fixture
def simple_graph_1():
"""Create a manual graph for testing purposes.

Returns
-------
torch_geometric.data.Data
Expand Down Expand Up @@ -133,43 +136,43 @@ def simple_graph_1():
return data



@pytest.fixture
def sg1_clique_lifted(simple_graph_1):
"""Return a simple graph with a clique lifting.

Parameters
----------
simple_graph_1 : torch_geometric.data.Data
A simple graph data object.

Returns
-------
torch_geometric.data.Data
A simple graph data object with a clique lifting.
"""
lifting_signed = SimplicialCliqueLifting(
complex_dim=3, signed=True
)
lifting_signed = Graph2SimplicialLiftingTransform(
SimplicialCliqueLifting(complex_dim=3), signed=True
)
data = lifting_signed(simple_graph_1)
data.batch_0 = "null"
return data


@pytest.fixture
def sg1_cell_lifted(simple_graph_1):
"""Return a simple graph with a cell lifting.

Parameters
----------
simple_graph_1 : torch_geometric.data.Data
A simple graph data object.

Returns
-------
torch_geometric.data.Data
A simple graph data object with a cell lifting.
"""
lifting = CellCycleLifting()
lifting = Graph2CellLiftingTransform(CellCycleLifting())
data = lifting(simple_graph_1)
data.batch_0 = "null"
return data
Expand All @@ -178,7 +181,7 @@ def sg1_cell_lifted(simple_graph_1):
@pytest.fixture
def simple_graph_2():
"""Create a manual graph for testing purposes.

Returns
-------
torch_geometric.data.Data
Expand Down Expand Up @@ -244,7 +247,7 @@ def simple_graph_2():
@pytest.fixture
def random_graph_input():
"""Create a random graph for testing purposes.

Returns
-------
torch.Tensor
Expand All @@ -261,13 +264,12 @@ def random_graph_input():
num_nodes = 8
d_feat = 12
x = torch.randn(num_nodes, 12)
edges_1 = torch.randint(0, num_nodes, (2, num_nodes*2))
edges_2 = torch.randint(0, num_nodes, (2, num_nodes*2))
edges_1 = torch.randint(0, num_nodes, (2, num_nodes * 2))
edges_2 = torch.randint(0, num_nodes, (2, num_nodes * 2))

d_feat_1, d_feat_2 = 5, 17

x_1 = torch.randn(num_nodes*2, d_feat_1)
x_2 = torch.randn(num_nodes*2, d_feat_2)
x_1 = torch.randn(num_nodes * 2, d_feat_1)
x_2 = torch.randn(num_nodes * 2, d_feat_2)

return x, x_1, x_2, edges_1, edges_2

Loading
Loading