Package: sinr
SINris an open-source tool to efficiently compute graph and word
embeddings. Its aim is to provide sparse interpretable vectors from a
graph structure. The dimensions of the vector produced are related to
the community structure detected in the graph. By leveraging the
relative connection of vertices to communities,SINrbuilds an
interpretable space.SINris focused on providing tools to build and
interpret the embeddings produced.SINris a Python module relying onNetworkitfor the graph structure and
community detection.SINralso provides efficient implementations to
extract word co-occurrence graphs from large text corpora. One of the
strength ofSINris its ability to work with text and produce
interpretable word embeddings that are competitive with similar
approaches. For more details on the performances ofSINron downstream
evaluation tasks, please refer to thePublicationssection.RequirementsAs SINr relies on libraries implemented using C/C++, a modern C++
compiler is required.OpenMP (required forNetworkitand
compilingSINr’s CythonPython 3.9PipCythonConda (recommended)InstallSINr can be installed throughpipor from source usingpoetrydirectives.pipcondaactivatesinr# activate conda environmentpipinstallsinrfrom sourcecondaactivatesinr# activate conda environmentgitclonegit@github.com:SINr-Embeddings/sinr.gitcdsinrpipinstallpoetry# poetry solves dependencies and installs SINrpoetryinstall# installs SINr based on the pyproject.toml fileUsage exampleTo get started usingSINrto build graph and word embeddings, have a
look at thenotebookdirectory.Here is a minimum working example ofSINrimporturllibimportioimportgzipimportnetworkitasnkimportsinr.graph_embeddingsasgeurl="https://snap.stanford.edu/data/wiki-Vote.txt.gz"graph_file="wikipedia-votes.txt"# Read a graph from SNAPsock=urllib.request.urlopen(url)# open URLs=io.BytesIO(sock.read())# read into BytesIO "file"sock.close()withgzip.open(s,"rt")asf_in:withopen(graph_file,"wt")asf_out:f_out.writelines(f_in.readlines())# Initialize a networkit.Graph object from SNAP graphG=nk.readGraph(graph_file,nk.Format.SNAP)# Build a SINr model and extract embeddingsmodel=ge.SINr.load_from_graph(G)model.run(algo=nk.community.PLM(G))embeddings=model.get_nr()print(embeddings)DocumentationThe documentation forSINrisavailable
online.ContributingPull requests are welcome. For major changes, please open an issue first
to disccus the changes to be made.LicenseReleased underCeCILL 2.1, seeLICENSEfor more details.PublicationsSINris currently maintained at theUniversity of Le Mans. If you
findSINruseful for your own research, please cite the appropriate
papers from the list below. Publications can also be found onpublications page in the
documentation.Initial SINr paper, 2021Thibault Prouteau, Victor Connes, Nicolas Dugué, Anthony Perez,
Jean-Charles Lamirel, et al.. SINr: Fast Computing of Sparse
Interpretable Node Representations is not a Sin!. Advances in
Intelligent Data Analysis XIX, 19th International Symposium on
Intelligent Data Analysis, IDA 2021, Apr 2021, Porto, Portugal.
pp.325-337,
⟨10.1007/978-3-030-74251-5_26⟩.⟨hal-03197434⟩Interpretability of SINr embeddingThibault Prouteau, Nicolas Dugué, Nathalie Camelin, Sylvain Meignier.
Are Embedding Spaces Interpretable? Results of an Intrusion Detection
Evaluation on a Large French Corpus. LREC 2022, Jun 2022, Marseille,
France.⟨hal-03770444⟩