sketchgraphs_models.graph.dataset

Main preprocessing strategies for model that encompasses the “subnode” model plus both constraint and entity parameters.

All numerical parameters are represented in a one-hot fashion.

Classes

GraphDataset(sequences[, …])

Dataset for numerical constraint model.

Functions

sketchgraphs_models.graph.dataset.collate(batch, entity_feature_mapping: Optional[sketchgraphs.pipeline.graph_model.quantization.EntityFeatureMapping] = None, edge_feature_mapping: Optional[sketchgraphs.pipeline.graph_model.quantization.EdgeFeatureMapping] = None)

Collates a batch of examples into a single dictionary suitable for batched computation.

Parameters
  • batch (List) – A list of tuples representing a batch of graphs and targets.

  • entity_feature_mapping (EntityFeatureMapping, optional) – A feature mapping object to obtain entity features from instances.

  • edge_feature_mapping (EdgeFeatureMapping, optional) – A feature mapping object to obtain edge features from instances.

Returns

A dictionary containing the required features for the model.

Return type

dict

sketchgraphs_models.graph.dataset.graph_info_from_sequence(seq, entity_feature_mapping: sketchgraphs.pipeline.graph_model.quantization.EntityFeatureMapping, edge_feature_mapping: sketchgraphs.pipeline.graph_model.quantization.EdgeFeatureMapping)

Creates a representation of the sequence as a GraphInfo object.

If specified, this function will output the desired feature maps for entities and edges. If not specified, they will be set to None instead.

Parameters
  • seq (List[NodeOp or EdgeOp]) – A list of operations describing the construction of the sketch.

  • entity_feature_mapping (EntityFeatureMapping, optional) – If not None, the mapping scheme to be used to discretize entity features.

  • edge_feature_mapping (EdgeFeatureMapping, optional) – If not None, the mapping scheme to be used to discretize edge features.

Returns

A GraphInfo object representing the sketch.

Return type

GraphInfo

sketchgraphs_models.graph.dataset.sketch_to_sequence(sketch)

Converts the given sketch to a construction sequence.

Modules

sketchgraphs_models.graph.dataset.benchmark

Utility to benchmark data loading speed.