sketchgraphs.pipeline.graph_model.quantization.EdgeFeatureMapping

class sketchgraphs.pipeline.graph_model.quantization.EdgeFeatureMapping(angle=None, length=None)

Helper class for extracting numerical features from edges.

__init__(angle=None, length=None)

Creates a new mapping, which uses the specified angle and length quantizers.

all_sparse_features(edge_ops)

Creates sparse features from the given edge ops for all supported labels.

Parameters

edge_ops (List of EdgeOp) – The list of edge operations for which to extract the sparse features.

Returns

A dictionary with keys given by self.supported_targets, and values representing the corresponding sparse features in a SparseFeatureBatch.

Return type

dict

property feature_schema

Gets a dictionary representing the schema for numerical features.

features_from_index(indices, target)

Obtains categorical features from the given indices.

Parameters
  • indices (sequence of integers) – A sequence of integers representing the index of each sub-feature

  • target (TargetType) – The type of target that should be decoded from the indices

Returns

An ordered dictionary containing the decoded features.

Return type

collections.OrderedDict

sparse_numerical_features(edge_ops, target)

Creates sparse numeric features from the given edge ops for the given label.