Skip to main content

pypi distribution for BREC

Project description

Towards Better Evaluation of GNN Expressiveness with BREC Dataset

About

This package is official implementation of the following paper: Towards Better Evaluation of GNN Expressiveness with BREC Dataset. Evalution process can be easily implemented by this package. For more detailed and advanced usage, please refer to BREC

BREC is a new dataset for GNN expressiveness comparison. It addresses the limitations of previous datasets, including difficulty, granularity, and scale, by incorporating 400 pairs of various graphs in four categories (Basic, Regular, Extension, CFI). The graphs are organized pair-wise, where each pair is tested individually to return whether a GNN can distinguish them. We propose a new evaluation method, RPC (Reliable Paired Comparisons), with a contrastive training framework.

Usages

Install

Install pytorch and pytorch_geometric with corresponding versions aligning with your device. Then pip install brec.

Example

Here is a simple example:

import torch
import torch.nn.functional as F
from torch_geometric.nn import GCNConv

from brec.dataset import BRECDataset
from brec.evaluator import evaluate


class GCN(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = GCNConv(1, 16)
        self.conv2 = GCNConv(16, 16)

    def forward(self, data):
        x, edge_index = data.x, data.edge_index

        x = self.conv1(x, edge_index)
        x = F.relu(x)
        x = F.dropout(x, training=self.training)
        x = self.conv2(x, edge_index)

        return x

    def reset_parameters(self):
        self.conv1.reset_parameters()
        self.conv2.reset_parameters()


model = GCN()

dataset = BRECDataset()
evaluate(
    dataset, model, device=torch.device("cpu"), log_path="log.txt", training_config=None
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brec-1.0.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

brec-1.0.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file brec-1.0.0.tar.gz.

File metadata

  • Download URL: brec-1.0.0.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for brec-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3512ea05e25a754e1b87ebd8e49e2c5d69337fe97970227b941d7a2e8bbb74c2
MD5 51e1a642700a377e37bf4c2ead169e27
BLAKE2b-256 dc664775b78c96069c6e1c841d50a4c974855d121218cb996e394d63409875c1

See more details on using hashes here.

File details

Details for the file brec-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: brec-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for brec-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d183bb08cbce75e675912275ccbaa3507b9eeaba8432680dcf0fd76322685fc
MD5 7af202b8796ac6aa29494f7cf8dad7cc
BLAKE2b-256 d5e2ddbdc36534a25ba8cf2c1464f8430c1b1a97077bc71c6f6c337c25c53db5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page