Add your description here
Project description
This project implements a graph generator inspired by the DictionaryLookup Benchmark from "How Attentive are Graph Neural Networks".
The problem is described as follows:
-
A bi-partite graph,
G
, is provided, with nodes split into two setsTOP
,BOT
. -
The set
TOP
is a subset ofKeys
. -
The set
BOT
is a bijectionKeys -> Values
represented as a subset ofKeys x Values
.
- For example if
("A", 1)
is inBOT
then no other element can have"A"
for a key or1
as a value.
- The goal is to map each key in TOP to the approriate value via
BOT(key)
.
The encoding provided by this repo is to take: Key = 1..n_keys
and Values = 1..n_vals
for some integers, n_vals
and n_vals
. The primary interface to this code is the
gen_problems
function which takes these in along with a random seed and provides
an infinite sequence of dictionary lookup problems.
from dict_lookup_mpnn_problem import gen_problems
problems = gen_problems(n_keys=2, n_vals=3, seed=12)
p1 = next(problems)
- Here
p1
is aProblem
object with three relevant attributes:adj
: Adjacency matrix (it's block anti-diagonal).nodes
: Array of node features (see below).answers
: What value thei
th node should decode to.
- The feature encoding is the 1-hot encoding of the key concatenated with the 1-hot encoding of the value. If no value is present, the all zeros vector is used.
An example output for n_keys=2
and n_vals=3
is provided below.
Problem(nodes=array([[1., 0., 0., 0., 0.],
[0., 1., 0., 0., 0.],
[1., 0., 1., 0., 0.],
[0., 1., 0., 0., 1.]]),
adj=array([[0., 0., 1., 1.],
[0., 0., 1., 1.],
[1., 1., 0., 0.],
[1., 1., 0., 0.]]),
answers=array([0, 2]),
n_keys=2)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dict_lookup_mpnn_problem-0.1.1.tar.gz
.
File metadata
- Download URL: dict_lookup_mpnn_problem-0.1.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e25d65edd768341afc70b029d33ae8f422d4d5418618f445b28cfa3ed2cea10e |
|
MD5 | 9ee122756274c30f6294f0000eba819f |
|
BLAKE2b-256 | cdf7f0777cef1af5fd05ea4abe687e6aff801f90a625316425626df2f81023dd |
File details
Details for the file dict_lookup_mpnn_problem-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: dict_lookup_mpnn_problem-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82cd2cad09993ff0a55020934f6d984dc866474e60bef3f07526ee0e2efbcdf8 |
|
MD5 | 0b25456453bebac6f426d470478a47d3 |
|
BLAKE2b-256 | 2574435c9883a574e1685b6fa3b0a2511bffe15cecf08b7232aa2caa54d9b810 |