nsl.tools.build_graph | Neural Structured Learning | TensorFlow (original) (raw)
nsl.tools.build_graph
Stay organized with collections Save and categorize content based on your preferences.
Like nsl.tools.build_graph_from_config, but with individual parameters.
nsl.tools.build_graph(
embedding_files,
output_graph_path,
similarity_threshold=0.8,
id_feature_name='id',
embedding_feature_name='embedding',
lsh_splits=0,
lsh_rounds=2,
random_seed=None
)
This API exists to maintain backward compatibility, but is deprecated in favor of using nsl.tools.build_graph_from_config instead.
Args | |
---|---|
embedding_files | A list of names of TFRecord files containingtf.train.Example objects, which in turn contain dense embeddings. |
output_graph_path | Name of the file to which the output graph in TSV format should be written. |
similarity_threshold | Threshold used to determine which edges to retain in the resulting graph. |
id_feature_name | The name of the feature in the input tf.train.Exampleobjects representing the ID of examples. |
embedding_feature_name | The name of the feature in the inputtf.train.Example objects representing the embedding of examples. |
lsh_splits | Determines the maximum number of LSH buckets into which input data points will be bucketed by the graph builder. See thensl.tools.build_graph_from_config documentation for details. |
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. |
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. |
Raises | |
---|---|
ValueError | If lsh_splits < 0 or if lsh_splits > 0 and lsh_rounds < 1. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-10-28 UTC.