Skip to main content

Implementation of the deep latent positions and topics model (Deep-LPTM)

Project description

The Deep Latent Topic Model package

This code is provided with the Deep-LPTM paper. The package can be used directly in command line or in a python script as described below.

Command line

This section provides an example of usage of the package in the command line. Note that the folder at the data_path location is assumed to hold the binary adjacency matrix in adjacency.csv, and the texts in texts.csv as a matrix T, such that $$T[i,j]$$ = doc sent from node $i$ to node $j$

python main.py -K 3 -Q 4 --data_path data_path --save_results True --save_path results_path --init_type dissimilarity --max_iter 10 --tol 0.001 --initialise_etm True Other arguments can be provided.

Function

To use the package in a script, the following arguments are required:

  • adj: (array) binary adjacency matrix of the directed graph
  • W : (list of str) texts corresponding to the edges of the graph
  • Q : (int) number of clusters
  • K : (int) number of topics

The following function fits Deep-LPTM and provides the results in a dictionary:

from deeplptm_package import deeplptm 
results = deeplptm(adj, W, Q, K)

Remark: all the arguments that can be provided to deeplptm() are provided in the documentation. To access to this information, use the command help(deeplptm) in a Python terminal, after loading the package.

If you are interested in handling the text preprocessing yourselves, as well as getting your hands on the model, you can follow the tutorial notebook at doc/Tutorial_deep-LPTM.ipynb.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deeplptm-0.0.1.tar.gz (40.2 MB view hashes)

Uploaded Source

Built Distribution

deeplptm-0.0.1-py3-none-any.whl (246.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page