Missed TensorFlow World? Check out the recap. Learn more

Module: nsl.tools

View source on GitHub

Tools and APIs for preparing data for Neural Structured Learning.

In addition to the functions exported here, two of the modules can be invoked from the command-line as follows:

$ python -m neural_structured_learning.tools.build_graph ...
$ python -m neural_structured_learning.tools.pack_nbrs ...

For details on the command-line usage for these programs, see the nsl.tools.build_graph and nsl.tools.pack_nbrs documentation.

Modules

graph_utils module: Utility functions for manipulating (weighted) graphs.

Functions

add_edge(...): Adds an edge to a given graph.

add_undirected_edges(...): Makes all edges of the given graph bi-directional.

build_graph(...): Builds a graph based on dense embeddings and persists it in TSV format.

pack_nbrs(...): Prepares input for graph-based Neural Structured Learning and persists it.

read_tsv_graph(...): Reads the file filename containing graph edges in TSV format.

write_tsv_graph(...): Writes the given graph to the file filename in TSV format.