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 containing
tf.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.Example
objects representing the ID of examples.
|
embedding_feature_name
|
The name of the feature in the input
tf.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 the
nsl.tools.build_graph_from_config documentation for details.
|
lsh_rounds
|
The number of rounds of LSH bucketing to perform when
lsh_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 .
|