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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file deeplptm-0.0.1.tar.gz.

File metadata

  • Download URL: deeplptm-0.0.1.tar.gz
  • Upload date:
  • Size: 40.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for deeplptm-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e151de40d743a8ad973deef00600c00199115a491d275cacba5b2c015191d201
MD5 3ca1e32eaaab62a50b4b0677b9e50d99
BLAKE2b-256 8b54fa24ee0ac5baf21e0793532daf14ffa57d553d8485dac95e42bbd9c91940

See more details on using hashes here.

File details

Details for the file deeplptm-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: deeplptm-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 246.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for deeplptm-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab1a0cec341eb4182c9cee5fcb56db62eb64f499674d6437d0a703eef9facde6
MD5 5535815fde9a44d87d24c26ab2d5595d
BLAKE2b-256 7636dd01532a601ab89924a5cca4f4ff5ad5b9286716c94f99a2c3b8b3255f77

See more details on using hashes here.

Supported by

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