torch_geometric_signed_directed.utils.signed.unhappy_ratio

Classes

Unhappy_Ratio

A calculation of the ratio of unhappy edges among all edges from the

Module Contents

class Unhappy_Ratio(A_p: scipy.sparse.spmatrix, A_n: scipy.sparse.spmatrix)

Bases: torch.nn.Module

A calculation of the ratio of unhappy edges among all edges from the SSSNET: Semi-Supervised Signed Network Clustering paper.

Parameters:
  • A_p (scipy sparse matrices) – Positive part of adjacency matrix A.

  • A_n (scipy sparse matrices) – Negative part of adjacency matrix A.

mat
num_edges
forward(prob: torch.FloatTensor) torch.Tensor

Making a forward pass of the calculation of the ratio of unhappy edges among all edges. Arg types:

  • prob (PyTorch FloatTensor) - Prediction probability matrix made by the model

Return types:
  • loss value (torch.Tensor).