Skip to content

Commit

Permalink
removed unused class
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbinschmid committed Jun 10, 2024
1 parent d8acf4a commit 1a10d56
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions datasets/transforms.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import gudhi
import numpy as np
import torch
from toponetx.classes import SimplicialComplex
from toponetx.utils import (
compute_bunch_normalized_matrices,
compute_x_laplacian_normalized_matrix,
)
from torch_geometric.transforms import ToUndirected
from torch_geometric.utils import degree

# import torchvision.transforms as transforms
from torch_geometric.transforms import FaceToEdge, OneHotDegree
from datasets.utils import (
create_signals_on_data_if_needed,
Expand All @@ -26,51 +21,6 @@ def __call__(self, data):
return data


class Simplex2VecTransform:
def __call__(self, data):
st = gudhi.SimplexTree()

ei = [
[edge[0], edge[1]]
for edge in data.edge_index.T.tolist()
if edge[0] < edge[1]
]
data.edge_index = torch.tensor(ei).T
# Say hi to bad programming
for edge in ei:
st.insert(edge)
st.expansion(3)

p1 = ks2v.assemble(cplx=st, k=1, scheme="uniform", laziness=None)
P1 = p1.toarray()

Simplices = list()
for simplex in st.get_filtration():
if simplex[1] != np.inf:
Simplices.append(simplex[0])
else:
break

## Perform random walks on the edges
L = 20
N = 40
Walks = ks2v.RandomWalks(walk_length=L, number_walks=N, P=P1, seed=3)
# to save the walks in a text file
ks2v.save_random_walks(Walks, "RandomWalks_Edges.txt")

## Embed the edges
Emb = ks2v.Embedding(
Walks=Walks,
emb_dim=20,
epochs=5,
filename="k-simplex2vec_Edge_embedding.model",
)
data.edge_attr = torch.tensor(Emb.wv.vectors)
toundirected = ToUndirected()
data = toundirected(data)
return data


class OrientableToClassTransform:
def __call__(self, data):
data.y = data.orientable.long()
Expand Down

0 comments on commit 1a10d56

Please sign in to comment.