Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
b2417cb
Minor edit to SparseCINConv
Jul 12, 2022
06571a5
Swap ordering of arguments for clarity
Jul 12, 2022
b30be7c
Copy paste code which will act as scaffolding
Jul 12, 2022
afc7d23
Change name and docstrings of LessSparse classes
Jul 12, 2022
bcc6d52
Fix copy paste mistake
Jul 12, 2022
b03f5c8
Edit docstrings to credit the code it's based on.
Jul 12, 2022
adc925c
Finish LessSparseCINCochainConv
Jul 12, 2022
dcde8f0
Finish LessSparseCINConv
Jul 12, 2022
fbae8ee
Copy paste EmbedSparseCIN to use for EmbedLessSparseCIN
Jul 12, 2022
33fdfd5
Add use_boundaries argument to LessSparseCINConv
Jul 12, 2022
063aa41
Implement EmbedLessSparseCIN
Jul 13, 2022
ca0923a
Connect LessSparse models with exp code&scripts
Jul 13, 2022
0d410bb
Adjust emb_dim for zinc-less-sparse
Jul 14, 2022
9b7968b
Add 'include_down_adj' option to zinc experiments
Jul 14, 2022
88f8d0a
Adjust test_zinc to account for new argument
Jul 15, 2022
a9061df
fix bug for less-sparse
Jul 15, 2022
c9defac
First draft co-boundary support for CochainMessagePassing
Jul 16, 2022
69db3ed
Copy paste existing tests to use as scaffolding
Jul 17, 2022
a75817c
Finish tests for less sparse molecular models
Jul 17, 2022
2481712
copy paste code for test_include_coboundary_links
Jul 20, 2022
249ac4a
Add coboundary link tests to data.test_utils
Jul 20, 2022
d85df01
Add coboundary index support to data.utils
Jul 20, 2022
11bb3dd
Add coboundary support to CochainMessagePassingParams
Jul 20, 2022
07b4961
Copy paste LessSparse Conv's as Dense Conv's
Jul 21, 2022
4267337
Add DenseCINConv in mp.layers
Jul 21, 2022
04cba0f
Copy paste code for EmbedDenseCIN
Jul 21, 2022
1640edb
Merge branch 'main' into coboundaries
Jul 22, 2022
d1ceaab
Fix utils bug
Jul 22, 2022
f5b4126
Add include_coboundary_links support for ZincDataset
Jul 22, 2022
e7ecbd3
Add tests for coboundary link message passing
Jul 23, 2022
24ed9e2
Add coboundary_index to some dummy complexes
Jul 23, 2022
a6e4dba
fix test_utils
Jul 23, 2022
cdeabbe
Add EmbedDenseCIN
Jul 26, 2022
969e9dc
Add coboundaries
Jul 30, 2022
83fcb03
copy paste SparseConv to make SparseDeeperCCNConv
Jul 30, 2022
0b3d8e3
copy paste code for EmbedSparseDeeperCCN
Jul 31, 2022
b0aa016
Add exp script for DeeperCCN
Aug 1, 2022
04cf312
Implement DeeperCCN
Aug 1, 2022
2a83ec6
delete accidentally commited class
Aug 1, 2022
779c63f
Fix import
Aug 1, 2022
496c13b
Fix run_exp's DeeperCCN
Aug 1, 2022
c435b5a
fix bugs
Aug 1, 2022
aa4cf19
add cell_mp aggregation test for future
Aug 1, 2022
0eb259d
Fix DeeperCCN bugs
sunjin-k Aug 1, 2022
084f67d
Edit DeeperCCN tests
sunjin-k Aug 1, 2022
4beb87a
remove unnecessary dimension 'assert' in DeeperCCN
sunjin-k Aug 1, 2022
098a31c
Update DeeperCCN zinc script
sunjin-k Aug 1, 2022
3403f30
Add concat nn to DeeperCCN
sunjin-k Aug 2, 2022
a4e27af
Improve coboundary_links on utils.py
sunjin-k Aug 2, 2022
4acdc1f
Add include_coboundary_links attribute to InMemoryComplexDataset
sunjin-k Aug 2, 2022
8bb706f
Add data retrieval on proteins test w/ coboundary links
sunjin-k Aug 2, 2022
d502a32
Add include_coboundary_links to TUDataset
sunjin-k Aug 2, 2022
79704e8
change molec model tests' dataset to protein
sunjin-k Aug 2, 2022
8720752
update comment on deepergcn_utils.py
sunjin-k Aug 2, 2022
6408ea1
Refactor test_molec_models.py
sunjin-k Aug 2, 2022
d850003
lower learning rate deeperccn
Aug 3, 2022
725394d
Add 'use_up_msg' argument to CochainMessagePassing
Aug 3, 2022
8863cf0
Refactor Sparse/LessSparse/DenseCINCochainConv
Aug 4, 2022
4e04de4
Refactor Spar/LessSparse/DenseCINConv
Aug 4, 2022
bf81fc2
Slightly more stress test test_molec_models
Aug 4, 2022
fe72449
Refactor Embed{Sparse/LessSparse/Dense}CIN
Aug 5, 2022
260709b
Add 'variant' arg to OGBEmbedSparseCIN
Aug 5, 2022
a032ba4
Remove redundant params in DenseCINConv
Aug 5, 2022
5eae22c
Merge branch 'remove_redundant_params' into main
Aug 5, 2022
5778be7
Add 500k version of cwn-zinc-sparse
Aug 5, 2022
6af079b
Add LessSparse and Dense molhiv exp scripts
Aug 6, 2022
e76be26
Write script to find best num_workers
Aug 6, 2022
832f4b1
Small edit numworkers script
Aug 6, 2022
08bca8b
Change num_workers 2->0 in molhiv exp's.
Aug 6, 2022
ba57f2f
Add molhiv dense&less sparse LR search scripts
Aug 6, 2022
d1ccd1c
Merge branch 'main' of github.com:sunjink1m/cwn into main
Aug 6, 2022
6778d47
Change num_workers 2->0 in molhiv LR scripts
Aug 6, 2022
24f1d04
Add template for zinc tuning
Aug 8, 2022
1acf4b0
Add template for ZINC tuning
Aug 8, 2022
0edbd51
Preliminary files
Aug 8, 2022
8bf5a5e
Add 'omit_2cell_down' argument to molec models
Aug 8, 2022
a63f279
Rename prepare_zinc_tuning.py
Aug 9, 2022
ed8b4e6
Add molhiv tuning scripts
Aug 9, 2022
dee8ccb
Delete zinc tuning things.
Aug 9, 2022
10c1879
Finalize hyperparam grid for MOLHIV
Aug 9, 2022
99b6989
Fix 'device=0' in ogb_tuning
Aug 9, 2022
3a6f338
Stop git ignoring txt files in exp/results
sunjin-k Aug 10, 2022
ff5a6ae
Commit exp/results/**/*.txt
Aug 10, 2022
c56cd36
Upload more exp results
Aug 11, 2022
bff1deb
Original MOLHIV test results
Aug 12, 2022
52f8238
Preliminary 10seed exp before gridsearch completed
sunjin-k Aug 12, 2022
f5ac241
Add final less-sparse and dense grids for MOLHIV
sunjin-k Aug 13, 2022
7e1888b
Preliminary MOLHIV less-sparse results
sunjin-k Aug 13, 2022
54a8ebb
finish first gridsearch MOLHIV lesssparse
sunjin-k Aug 13, 2022
bd39eea
ORIGINAL COMMIT'S MOLHIV CWN RESULTS
sunjin-k Aug 13, 2022
e3d8afa
Fix bug in 'get_all_cochain_params'
sunjin-k Aug 16, 2022
a8a0740
temp edit gitignore
sunjin-k Aug 16, 2022
765c765
Add notebooks for viewing results, tutorial, degree check
sunjin-k Aug 16, 2022
c3678df
exp results
sunjin-k Aug 16, 2022
84be723
Merge branch 'main' of github.com:sunjink1m/cwn into main
sunjin-k Aug 16, 2022
dde4900
Complete MOLHIV lesssparse2 tuning
sunjin-k Aug 17, 2022
f8ba16a
Merge branch 'main' of github.com:sunjink1m/cwn into main
sunjin-k Aug 17, 2022
6eb5885
Rename SparseNormLayer -> NormLayer
sunjin-k Aug 17, 2022
d454659
Fix use_boundaries in MOLHIV
sunjin-k Aug 17, 2022
c2497dc
Add molhiv less-sparse tuning 3 and 4
sunjin-k Aug 17, 2022
fe5af11
remove breakpoint()
sunjin-k Aug 18, 2022
9c731b5
more exp results
sunjin-k Aug 20, 2022
b85821b
finish dense tuning and lesssparse4
sunjin-k Aug 21, 2022
cbac087
Add molhiv dense2 tuning scripts
sunjin-k Aug 21, 2022
d0716ad
Add lesssparse 5 tuning scripts
sunjin-k Aug 21, 2022
48cd5a0
widen dense2 grid
sunjin-k Aug 21, 2022
0d6124d
update notebooks
sunjin-k Aug 22, 2022
ff715a5
destroying the iceburgs
sunjin-k Aug 22, 2022
840002b
Merge branch 'main' of github.com:sunjink1m/cwn into main
sunjin-k Aug 22, 2022
a42a695
Original MOLHIV results (in previous commit)
sunjin-k Aug 22, 2022
dda403d
more dense2 results
sunjin-k Aug 23, 2022
4ce6a2e
Merge branch 'main' of github.com:sunjink1m/cwn into main
sunjin-k Aug 23, 2022
205c9e3
update LS5 grid
sunjin-k Aug 23, 2022
905a5f1
more results
sunjin-k Aug 24, 2022
e1e38bd
add slurm util
sunjin-k Aug 24, 2022
cb733e5
edit slurm util
sunjin-k Aug 24, 2022
6d9e436
more results
sunjin-k Aug 24, 2022
c3bf3a0
more results
sunjin-k Aug 25, 2022
992534f
more results
sunjin-k Aug 25, 2022
64bd6aa
just started ray machines
sunjin-k Aug 25, 2022
1ab3e35
sparse tuning script
sunjin-k Aug 25, 2022
1b55822
Merge branch 'main' of github.com:sunjink1m/cwn into main
sunjin-k Aug 25, 2022
e4528f4
Copy DenseCINConv for DenseCINConv2
sunjin-k Aug 26, 2022
09019fe
delete comments
sunjin-k Aug 26, 2022
fd79cde
copy test DenseCINConv for DenseCIN2Conv
sunjin-k Aug 26, 2022
74136f7
Add Basic CWN on OGB with script&tests
sunjin-k Aug 26, 2022
7928697
Merge branch 'main' of github.com:sunjink1m/cwn into main
sunjin-k Aug 26, 2022
9f9854d
UNLIMITED POWERERRERERE
sunjin-k Aug 26, 2022
3d34136
Merge branch 'main' of github.com:sunjink1m/cwn into main
sunjin-k Aug 26, 2022
a8a74c9
tons of results
sunjin-k Aug 27, 2022
0969931
Add 0.0001 to hyp grid
sunjin-k Aug 27, 2022
e7c046d
add 0.00003 to grids
sunjin-k Aug 27, 2022
e4ea2ff
cin tuning layer 2 scripts
sunjin-k Aug 27, 2022
29d6496
more res
sunjin-k Aug 27, 2022
12be389
more exp
sunjin-k Aug 28, 2022
fdf697e
copy denseCIN for making deeperCIN
sunjin-k Aug 28, 2022
a764a20
DeeperCIN & MOLPCBA script
sunjin-k Aug 28, 2022
8b26d3e
modify deeper script
sunjin-k Aug 28, 2022
9c18e93
Ignore nan labels in utils lifting assert labels same
sunjin-k Aug 28, 2022
0921b88
more exp
sunjin-k Aug 28, 2022
78333e2
update deper scripts
sunjin-k Aug 28, 2022
988089e
Add molhiv deeper script
sunjin-k Aug 28, 2022
5585232
modify deeper molhiv script
sunjin-k Aug 28, 2022
feeeb12
add molhiv deeper control exp
sunjin-k Aug 28, 2022
7968e74
more exp
sunjin-k Aug 29, 2022
aabd333
CIN gridsearch complete
sunjin-k Aug 29, 2022
bf8df94
add zinc param efficiency scripts
sunjin-k Aug 29, 2022
8b38e1e
zinc exps
sunjin-k Aug 30, 2022
ea77f78
revert molhiv original accidentally ran again
sunjin-k Aug 30, 2022
62847b0
cprofile scripts molpcba
sunjin-k Aug 30, 2022
26efcc0
fix prev commit
sunjin-k Aug 30, 2022
e7ae384
molpcba profile
sunjin-k Aug 30, 2022
00b1692
update profiles
sunjin-k Aug 30, 2022
284067b
update profiles
sunjin-k Aug 30, 2022
c521b37
fix tests
sunjin-k Aug 30, 2022
c174dcb
fix deeper cin
sunjin-k Aug 30, 2022
29a506d
update profile
sunjin-k Aug 30, 2022
7a9c872
exp complete
sunjin-k Aug 30, 2022
6ae0892
time scripts
sunjin-k Aug 30, 2022
4c477c9
time exps
sunjin-k Aug 30, 2022
ee2303e
molhiv cin best large
sunjin-k Aug 30, 2022
854a746
original zinc
sunjin-k Aug 30, 2022
0f2b98d
change name to use_{up,down}_attr
sunjin-k Aug 31, 2022
3d633c1
Add max_idx to tuning script.
sunjin-k Sep 2, 2022
ebb56e8
Add DeeperCIN tuning scripts
sunjin-k Sep 2, 2022
af1b316
complete MOLHIV dense-after-tun
sunjin-k Sep 2, 2022
365faca
Change name: use_boundaries -> use_down_attr
sunjin-k Sep 2, 2022
8483922
more deeper exps
sunjin-k Sep 3, 2022
ea28a07
more deeper exp
sunjin-k Sep 3, 2022
40387c4
more deeper exp
sunjin-k Sep 4, 2022
7cd5a4d
more deeper exps
sunjin-k Sep 5, 2022
3797895
more deeper exps
sunjin-k Sep 6, 2022
0a8bab3
deeper exp finished
sunjin-k Sep 13, 2022
d872168
Delete /exp/results
Dec 18, 2023
893b415
delete /notebooks
Dec 18, 2023
f37964b
delete files used for experiments
Dec 18, 2023
d7e9655
Remove all traces of DeeperCIN
sunjin-k Dec 21, 2023
561f24e
Fix accidentally added includes
sunjin-k Dec 21, 2023
a236cf9
Remove test_cmp_aggregating (originally for DeeperCIN)
sunjin-k Dec 21, 2023
1a6157b
Delete exp/results/DUMMYM-dummym_test/seed-43/results.txt
sunjin-k Dec 22, 2023
8f297b6
Revert .gitignore
sunjin-k Dec 21, 2023
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
36 changes: 28 additions & 8 deletions data/complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ class Cochain(object):
"""
def __init__(self, dim: int, x: Tensor = None, upper_index: Adj = None, lower_index: Adj = None,
shared_boundaries: Tensor = None, shared_coboundaries: Tensor = None, mapping: Tensor = None,
boundary_index: Adj = None, upper_orient=None, lower_orient=None, y=None, **kwargs):
boundary_index: Adj = None, coboundary_index: Adj = None,
upper_orient=None, lower_orient=None, y=None, **kwargs):
if dim == 0:
assert lower_index is None
assert shared_boundaries is None
Expand All @@ -72,6 +73,7 @@ def __init__(self, dim: int, x: Tensor = None, upper_index: Adj = None, lower_in
self.upper_index = upper_index
self.lower_index = lower_index
self.boundary_index = boundary_index
self.coboundary_index = coboundary_index
self.y = y
self.shared_boundaries = shared_boundaries
self.shared_coboundaries = shared_coboundaries
Expand Down Expand Up @@ -138,7 +140,7 @@ def __cat_dim__(self, key, value):
:obj:`key` will get concatenated when creating batches.
"""
if key in ['upper_index', 'lower_index', 'shared_boundaries',
'shared_coboundaries', 'boundary_index']:
'shared_coboundaries', 'boundary_index', 'coboundary_index']:
return -1
# by default, concatenate sparse matrices diagonally.
elif isinstance(value, SparseTensor):
Expand All @@ -160,7 +162,14 @@ def __inc__(self, key, value):
elif key == 'boundary_index':
boundary_inc = self.num_cells_down if self.num_cells_down is not None else 0
cell_inc = self.num_cells if self.num_cells is not None else 0
inc = [[boundary_inc], [cell_inc]]
inc = [[boundary_inc], [cell_inc]] # The first number is used to increase value
# of numbers on first row of boundary_index
# and the second number is used for the
# second row.
elif key == 'coboundary_index':
coboundary_inc = self.num_cells_up if self.num_cells_up is not None else 0
cell_inc = self.num_cells if self.num_cells is not None else 0
inc = [[coboundary_inc], [cell_inc]]
else:
inc = 0
if inc is None:
Expand Down Expand Up @@ -550,7 +559,8 @@ def get_cochain_params(self,
max_dim : int=2,
include_top_features=True,
include_down_features=True,
include_boundary_features=True) -> CochainMessagePassingParams:
include_boundary_features=True,
include_coboundary_features=True) -> CochainMessagePassingParams:
"""
Conveniently constructs all necessary input parameters to perform higher-dim
message passing on the cochain of specified `dim`.
Expand All @@ -562,6 +572,7 @@ def get_cochain_params(self,
include_top_features: Whether to include the top features from level max_dim+1.
include_down_features: Include the features for down adjacency
include_boundary_features: Include the features for the boundary
include_coboundary_features: Include the features for the coboundary
Returns:
An object of type CochainMessagePassingParams
"""
Expand Down Expand Up @@ -592,10 +603,17 @@ def get_cochain_params(self,
boundary_index = cells.boundary_index
if dim > 0 and self.cochains[dim - 1].x is not None:
boundary_features = self.cochains[dim - 1].x

# Add coboundary features

@sunjin-k sunjin-k Apr 17, 2025

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add coboundary features to the CochainMessagePassingParams that Cochain.get_cochain_params returns.

Explanation: A Cochain represents a subset of the graph (i.e. Complex, which is the main data object in this repository). CochainMessagePassingParams is a collection of current feature vectors prepared by Cochain each timestep, so it can be passed into the timestep's neural network layer.

# REVIEW: Is this correctly written?
coboundary_index, coboundary_features = None, None
if include_coboundary_features and cells.coboundary_index is not None:
coboundary_index = cells.coboundary_index
if self.cochains[dim + 1].x is not None:
coboundary_features = self.cochains[dim + 1].x
inputs = CochainMessagePassingParams(x, upper_index, lower_index,
up_attr=upper_features, down_attr=lower_features,
boundary_attr=boundary_features, boundary_index=boundary_index)
boundary_attr=boundary_features, boundary_index=boundary_index,
coboundary_attr=coboundary_features, coboundary_index=coboundary_index)
else:
raise NotImplementedError(
'Dim {} is not present in the complex or not yet supported.'.format(dim))
Expand All @@ -605,7 +623,8 @@ def get_all_cochain_params(self,
max_dim:int=2,
include_top_features=True,
include_down_features=True,
include_boundary_features=True) -> List[CochainMessagePassingParams]:
include_boundary_features=True,
include_coboundary_features=False) -> List[CochainMessagePassingParams]:
"""Extracts the cochain parameters for message passing on the cochains up to max_dim.

Args:
Expand All @@ -622,7 +641,8 @@ def get_all_cochain_params(self,
all_params.append(self.get_cochain_params(dim, max_dim=max_dim,
include_top_features=include_top_features,
include_down_features=include_down_features,
include_boundary_features=include_boundary_features))
include_boundary_features=include_boundary_features,
include_coboundary_features=include_coboundary_features))
return all_params

def get_labels(self, dim=None):
Expand Down
10 changes: 8 additions & 2 deletions data/data_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,14 @@ def load_dataset(name, root=os.path.join(ROOT_DIR, 'datasets'), max_dim=2, fold=
dataset = RingLookupDataset(os.path.join(root, name), nodes=kwargs['max_ring_size'])
elif name == 'ZINC':
dataset = ZincDataset(os.path.join(root, name), max_ring_size=kwargs['max_ring_size'],
use_edge_features=kwargs['use_edge_features'], n_jobs=n_jobs)
use_edge_features=kwargs['use_edge_features'], n_jobs=n_jobs,
include_down_adj=kwargs['include_down_adj'],
include_coboundary_links=kwargs['include_coboundary_links'])
elif name == 'ZINC-FULL':
dataset = ZincDataset(os.path.join(root, name), subset=False, max_ring_size=kwargs['max_ring_size'],
use_edge_features=kwargs['use_edge_features'], n_jobs=n_jobs)
use_edge_features=kwargs['use_edge_features'], n_jobs=n_jobs,
include_down_adj=kwargs['include_down_adj'],
include_coboundary_links=kwargs['include_coboundary_links'])
elif name == 'CSL':
dataset = CSLDataset(os.path.join(root, name), max_ring_size=kwargs['max_ring_size'],
fold=fold, n_jobs=n_jobs)
Expand All @@ -172,6 +176,8 @@ def load_dataset(name, root=os.path.join(ROOT_DIR, 'datasets'), max_dim=2, fold=
official_name = 'ogbg-'+name.lower()
dataset = OGBDataset(os.path.join(root, name), official_name, max_ring_size=kwargs['max_ring_size'],
use_edge_features=kwargs['use_edge_features'], simple=kwargs['simple_features'],
include_down_adj=kwargs['include_down_adj'],
include_coboundary_links=kwargs['include_coboundary_links'],
init_method=init_method, n_jobs=n_jobs)
elif name == 'DUMMY':
dataset = DummyDataset(os.path.join(root, name))
Expand Down
4 changes: 3 additions & 1 deletion data/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ def process(self):

def __init__(self, root=None, transform=None, pre_transform=None,
pre_filter=None, max_dim: int = None, num_classes: int = None,
include_down_adj=False, init_method=None, cellular: bool = False):
include_down_adj=False, init_method=None, cellular: bool = False,
include_coboundary_links=False):
self.include_down_adj = include_down_adj
self.include_coboundary_links = include_coboundary_links
super(InMemoryComplexDataset, self).__init__(root, transform, pre_transform, pre_filter,
max_dim, num_classes, init_method=init_method,
cellular=cellular)
Expand Down
12 changes: 9 additions & 3 deletions data/datasets/ogb.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ class OGBDataset(InMemoryComplexDataset):
"""This is OGB graph-property prediction. This are graph-wise classification tasks."""

def __init__(self, root, name, max_ring_size, use_edge_features=False, transform=None,
pre_transform=None, pre_filter=None, init_method='sum', simple=False, n_jobs=2):
pre_transform=None, pre_filter=None, init_method='sum', simple=False, n_jobs=2,
include_down_adj=False, include_coboundary_links=False):
self.name = name
self._max_ring_size = max_ring_size
self._use_edge_features = use_edge_features
self._simple = simple
self._n_jobs = n_jobs
super(OGBDataset, self).__init__(root, transform, pre_transform, pre_filter,
max_dim=2, init_method=init_method, cellular=True)
max_dim=2, init_method=init_method, cellular=True,
include_down_adj=include_down_adj,
include_coboundary_links=include_coboundary_links)
self.data, self.slices, idx, self.num_tasks = self.load_dataset()
self.train_ids = idx['train']
self.val_ids = idx['valid']
Expand All @@ -40,7 +43,9 @@ def processed_dir(self):
suffix1 = f"_{self._max_ring_size}rings" if self._cellular else ""
suffix2 = "-E" if self._use_edge_features else ""
suffix3 = "-S" if self._simple else ""
return directory + suffix1 + suffix2 + suffix3
suffix4 = "-DA" if self.include_down_adj else ""
suffix5= "-CBL" if self.include_coboundary_links else ""
return directory + suffix1 + suffix2 + suffix3 + suffix4 + suffix5

def download(self):
# Instantiating this will download and process the graph dataset.
Expand Down Expand Up @@ -73,6 +78,7 @@ def process(self):
include_down_adj=self.include_down_adj,
init_method=self._init_method,
init_edges=self._use_edge_features,
include_coboundary_links=self.include_coboundary_links,
init_rings=False,
n_jobs=self._n_jobs)

Expand Down
8 changes: 6 additions & 2 deletions data/datasets/test_zinc.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

@pytest.mark.slow
def test_zinc_splits_are_retained():
dataset1 = load_dataset("ZINC", max_ring_size=7, use_edge_features=True)
dataset1 = load_dataset("ZINC", max_ring_size=7, use_edge_features=True,
include_down_adj=False,
include_coboundary_links=False)
dataset1_train = dataset1.get_split('train')
dataset1_valid = dataset1.get_split('valid')
dataset1_test = dataset1.get_split('test')
Expand Down Expand Up @@ -40,7 +42,9 @@ def test_zinc_splits_are_retained():
@pytest.mark.slow
def test_we_find_only_the_induced_cycles_on_zinc():
max_ring = 7
dataset = load_dataset("ZINC", max_ring_size=max_ring, use_edge_features=True)
dataset = load_dataset("ZINC", max_ring_size=max_ring, use_edge_features=True,
include_down_adj=False,
include_coboundary_links=False)
# Check only on validation to save time. I've also run once on the whole dataset and passes.
dataset = dataset.get_split('valid')

Expand Down
9 changes: 7 additions & 2 deletions data/datasets/tu.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class TUDataset(InMemoryComplexDataset):
"""A dataset of complexes obtained by lifting graphs from TUDatasets."""

def __init__(self, root, name, max_dim=2, num_classes=2, degree_as_tag=False, fold=0,
init_method='sum', seed=0, include_down_adj=False, max_ring_size=None):
init_method='sum', seed=0, include_down_adj=False, max_ring_size=None,
include_coboundary_links=False):
self.name = name
self.degree_as_tag = degree_as_tag
assert max_ring_size is None or max_ring_size > 3
Expand All @@ -48,7 +49,8 @@ def __init__(self, root, name, max_dim=2, num_classes=2, degree_as_tag=False, fo
assert max_dim == 2

super(TUDataset, self).__init__(root, max_dim=max_dim, num_classes=num_classes,
init_method=init_method, include_down_adj=include_down_adj, cellular=cellular)
init_method=init_method, include_down_adj=include_down_adj, cellular=cellular,
include_coboundary_links=include_coboundary_links)

self.data, self.slices = torch.load(self.processed_paths[0])

Expand Down Expand Up @@ -79,6 +81,7 @@ def processed_dir(self):
directory = super(TUDataset, self).processed_dir
suffix = f"_{self._max_ring_size}rings" if self._cellular else ""
suffix += f"_down_adj" if self.include_down_adj else ""
suffix += f"_CBL" if self.include_coboundary_links else ""
return directory + suffix

@property
Expand Down Expand Up @@ -108,6 +111,7 @@ def process(self):
print("Converting the dataset accounting for rings...")
complexes, _, _ = convert_graph_dataset_with_rings(graph_list, max_ring_size=self._max_ring_size,
include_down_adj=self.include_down_adj,
include_coboundary_links=self.include_coboundary_links,
init_method=self._init_method,
init_edges=True, init_rings=True)
else:
Expand All @@ -116,6 +120,7 @@ def process(self):
# What about the init_method here? Adding now, although I remember we had handled this
complexes, _, _ = convert_graph_dataset_with_gudhi(graph_list, expansion_dim=self.max_dim,
include_down_adj=self.include_down_adj,
include_coboundary_links=self.include_coboundary_links,
init_method=self._init_method)

torch.save(self.collate(complexes, self.max_dim), self.processed_paths[0])
Expand Down
15 changes: 12 additions & 3 deletions data/datasets/zinc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ class ZincDataset(InMemoryComplexDataset):
"""This is ZINC from the Benchmarking GNNs paper. This is a graph regression task."""

def __init__(self, root, max_ring_size, use_edge_features=False, transform=None,
pre_transform=None, pre_filter=None, subset=True, n_jobs=2):
pre_transform=None, pre_filter=None, subset=True, n_jobs=2,
include_down_adj=False, include_coboundary_links=False):
self.name = 'ZINC'
self.include_coboundary_links = include_coboundary_links
self._max_ring_size = max_ring_size
self._use_edge_features = use_edge_features
self._subset = subset
self._n_jobs = n_jobs
super(ZincDataset, self).__init__(root, transform, pre_transform, pre_filter,
max_dim=2, cellular=True, num_classes=1)
max_dim=2, cellular=True, num_classes=1,
include_down_adj=include_down_adj,
include_coboundary_links=include_coboundary_links)

self.data, self.slices, idx = self.load_dataset()
self.train_ids = idx[0]
Expand Down Expand Up @@ -62,6 +66,7 @@ def process(self):
train_data,
max_ring_size=self._max_ring_size,
include_down_adj=self.include_down_adj,
include_coboundary_links=self.include_coboundary_links,
init_edges=self._use_edge_features,
init_rings=False,
n_jobs=self._n_jobs)
Expand All @@ -73,6 +78,7 @@ def process(self):
val_data,
max_ring_size=self._max_ring_size,
include_down_adj=self.include_down_adj,
include_coboundary_links=self.include_coboundary_links,
init_edges=self._use_edge_features,
init_rings=False,
n_jobs=self._n_jobs)
Expand All @@ -84,6 +90,7 @@ def process(self):
test_data,
max_ring_size=self._max_ring_size,
include_down_adj=self.include_down_adj,
include_coboundary_links=self.include_coboundary_links,
init_edges=self._use_edge_features,
init_rings=False,
n_jobs=self._n_jobs)
Expand All @@ -105,7 +112,9 @@ def processed_dir(self):
suffix0 = "_full" if self._subset is False else ""
suffix1 = f"_{self._max_ring_size}rings" if self._cellular else ""
suffix2 = "-E" if self._use_edge_features else ""
return directory + suffix0 + suffix1 + suffix2
suffix3 = f"_down_adj" if self.include_down_adj else ""
suffix4 = f"_CBL" if self.include_coboundary_links else ""
return directory + suffix0 + suffix1 + suffix2 + suffix3 + suffix4


def load_zinc_graph_dataset(root, subset=True):
Expand Down
Loading