nsl.configs.GraphBuilderConfig  |  Neural Structured Learning  |  TensorFlow (original) (raw)

nsl.configs.GraphBuilderConfig

Stay organized with collections Save and categorize content based on your preferences.

Encapsulates configuration parameters for building a graph.

nsl.configs.GraphBuilderConfig(
    id_feature_name=attr_dict['id_feature_name'].default,
    embedding_feature_name=attr_dict['embedding_feature_name'].default,
    similarity_threshold=attr_dict['similarity_threshold'].default,
    lsh_splits=attr_dict['lsh_splits'].default,
    lsh_rounds=attr_dict['lsh_rounds'].default,
    random_seed=attr_dict['random_seed'].default
)

Used in the notebooks

Used in the tutorials
Graph regularization for sentiment classification using synthesized graphs Graph-based Neural Structured Learning in TFX

For more information, see nsl.tools.build_graph_from_config.

Attributes
id_feature_name The name of the feature in the input tf.train.Exampleobjects representing the ID of examples. Defaults to 'id'.
embedding_feature_name The name of the feature in the inputtf.train.Example objects representing the embedding of examples. Defaults to 'embedding'.
similarity_threshold Threshold used to determine which edges to retain in the resulting graph. Defaults to 0.8.
lsh_splits On each LSH bucketing round, the space containing the input instances will be randomly split/partitioned this many times for better graph builder performance. See the nsl.tools.build_graph_from_configdocumentation for details. Defaults to 0, in which case all pairs of inputs will be compared, probably resulting in slow running times on larger input sets.
lsh_rounds The number of rounds of LSH bucketing to perform whenlsh_splits > 0. This is also the number of LSH buckets each point will be hashed into. Defaults to 1.
random_seed Value used to seed the random number generator used to perform randomized LSH bucketing of the inputs when lsh_splits > 0. By default, the generator will be initialized randomly, but setting this to any integer will initialize it deterministically. Defaults to None.

Methods

__eq__

__eq__(
    other
)

Method generated by attrs for class GraphBuilderConfig.

__ge__

__ge__(
    other
)

Method generated by attrs for class GraphBuilderConfig.

__gt__

__gt__(
    other
)

Method generated by attrs for class GraphBuilderConfig.

__le__

__le__(
    other
)

Method generated by attrs for class GraphBuilderConfig.

__lt__

__lt__(
    other
)

Method generated by attrs for class GraphBuilderConfig.

__ne__

__ne__(
    other
)

Method generated by attrs for class GraphBuilderConfig.