sketchgraphs_models.graph.model

Implementation of main graph-based model.

This module contains the implementation of the main graph-based model.

Classes

EdgePartnerNetwork(readout_net)

Predicts a probability for a new edge from a node to the last node in the graph.

GraphModel(model_core, entity_label, …)

Main model class for the graph-based models.

Functions

sketchgraphs_models.graph.model.make_graph_model(hidden_size, feature_dimensions, message_passing_rounds=3, readout_edge_features=True, readout_entity_features=True, readin_edge_features=None, readin_entity_features=None)

Create a graph model using the default inner architectural choices.

The main graph model architecture is described as a large number of specific networks assembled together. This function chooses the architecture of all these networks from a couple of parameters to be specified.

Parameters
  • hidden_size (int) – An integer parameter controlling the width of layers in the network.

  • feature_dimensions (Dict[TargetType, List[int]]) – A dictionary describing the size of attribute features for each target type.

  • message_passing_rounds (int) – An integer parameter controlling the number of message passing rounds in the model core.

  • readout_edge_features (bool) – If true, indicates that the model should predict and output logits for edge features. Otherwise, edge feature prediction tasks are ignored.

  • readout_entity_features (bool) – If true, indicates that the model should predict and output logits for entity features. Otherwise, entity feature prediction tasks are ignored.

  • readin_edge_features (bool, optional) – If True, indicates that the model should use edge features as inputs. Otherwise, ignores input edge features (and only considers edge labels). If None, set to the same value as readout_edge_features. Note that setting this to a different value than readout_edge_features will prevent meaningful generation from the model.

  • readin_entity_features (bool, optional) – If True, indicates that the model should use entity features as inputs. Otherwise, ignores input entity features (and only considers entity labels). If None, set to the same value as readout_entity_features.

Returns

A new GraphModel instance with the default architecture.

Return type

GraphModel

Modules

sketchgraphs_models.graph.model.losses

This module implements the necessary code to compute losses from the output of the graph model.

sketchgraphs_models.graph.model.message_passing

This module contains the components of the graph model associated with handling the message passing.

sketchgraphs_models.graph.model.numerical_features

This module contains the components of the graph model that are concerned with handling numerical features associated with edges and nodes.