Skip to content

Commit

Permalink
Add left/right for non-multi case in MGB (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
dobraczka authored Mar 25, 2024
1 parent 144fefe commit f26beb2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sylloge/moviegraph_benchmark_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ def __init__(
dataset_names=ds_names,
ds_prefix_tuples=GP_TO_DS_PREFIX[graph_pair],
)
if graph_pair != MULTI:
self.rel_triples_left = self.rel_triples[0]
self.rel_triples_right = self.rel_triples[1]
self.attr_triples_left = self.attr_triples[0]
self.attr_triples_right = self.attr_triples[1]

def initial_read(self, backend: BACKEND_LITERAL):
assert self._ds_prefixes
Expand Down Expand Up @@ -130,6 +135,14 @@ def initial_read(self, backend: BACKEND_LITERAL):
"folds": folds,
}

def __repr__(self) -> str:
repr_str = super().__repr__()
if self.graph_pair != MULTI:
return repr_str.replace("triples_0", "triples_left").replace(
"triples_1", "triples_right"
)
return repr_str

@property
def _canonical_name(self) -> str:
return f"{self.__class__.__name__}_{self.graph_pair}"
Expand Down
3 changes: 3 additions & 0 deletions tests/test_moviebenchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,6 @@ def test_movie_benchmark_mock(
assert fold.test is not None
assert fold.val is not None
assert ds._ds_prefixes is not None
if ds.graph_pair != MULTI:
assert "triples_left" in ds.__repr__()
assert ds.rel_triples_left is not None

0 comments on commit f26beb2

Please sign in to comment.