nsbm

nSBM: multi branch topic modeling

https://github.com/fvalle1/nsbm

Science Score: 64.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    1 of 4 committers (25.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.6%) to scientific vocabulary

Keywords

hacktoberfest hacktoberfest-accepted hacktoberfest2022 hacktoberfest2024 natural-language-processing python stochastic-simulation-algorithm topic-modeling
Last synced: 4 months ago · JSON representation ·

Repository

nSBM: multi branch topic modeling

Basic Info
  • Host: GitHub
  • Owner: fvalle1
  • License: gpl-3.0
  • Language: Jupyter Notebook
  • Default Branch: main
  • Homepage:
  • Size: 16.5 MB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • Open Issues: 0
  • Releases: 18
Topics
hacktoberfest hacktoberfest-accepted hacktoberfest2022 hacktoberfest2024 natural-language-processing python stochastic-simulation-algorithm topic-modeling
Created almost 5 years ago · Last pushed about 1 year ago
Metadata Files
Readme License Citation

README.md

DOI Documentation Status Python package Conda test Docker GPL

multipartite Stochastic Block Modeling

Inheriting hSBM from https://github.com/martingerlach/hSBM_Topicmodel extends it to tripartite networks (aka supervised topic models)

The idea is to run SBM-based topic modeling on networks given keywords on documents

network

Install

With pip

bash python3 -m pip install . -vv

With conda/mamba

bash conda install -c conda-forge nsbm

Example

```python from nsbm import nsbm import pandas as pd import numpy as np

df = pd.DataFrame( index = ["w{}".format(w) for w in range(1000)], columns = ["doc{}".format(d) for d in range(250)], data = np.random.randint(1, 100, 250000).reshape((1000, 250)))

dfkeylist = []

keywords

dfkeylist.append( pd.DataFrame( index = ["keyword{}".format(w) for w in range(100)], columns = ["doc{}".format(d) for d in range(250)], data = np.random.randint(1, 10, (100, 250))) )

authors

dfkeylist.append( pd.DataFrame( index = ["author{}".format(w) for w in range(10)], columns = ["doc{}".format(d) for d in range(250)], data = np.random.randint(1, 5, (10, 250))) )

other features

dfkeylist.append( pd.DataFrame( index = ["feature{}".format(w) for w in range(25)], columns = ["doc{}".format(d) for d in range(250)], data = np.random.randint(1, 5, (25, 250))) )

model = nsbm() model.makegraphmultipledf(df, dfkey_list)

model.fit(ninit=1, Bmin=50, verbose=False) model.save_data() ```

Run with Docker

bash docker run -it -u jovyan -v $PWD:/home/jovyan/work -p 8899:8888 docker.pkg.github.com/fvalle1/trisbm/trisbm:latest

If a graph.xml.gz file is found in the current dir the analysis will be performed on it.

Tests

bash python3 tests/run_tests.py

Caveats

Please check this stuff in your data: - there should be no zero-degree nodes (all nodes should have at least one link) - there shouldn't be any duplicate node - The make_form_BoW_df function discretises the data

Documentation

Docs

Readthedocs

License

See LICENSE.

This work is in part based on sbmtm

Third party libraries

This package depends on graph-tool

Owner

  • Name: Filippo Valle
  • Login: fvalle1
  • Kind: user
  • Location: Turin, Italy
  • Company: @Elemento-Modular-Cloud

Chief Technology Officer of @Elemento-Modular-Cloud | Complex Systems researcher @BioPhys-Turin

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Valle"
  given-names: "Filippo"
  orcid: "https://orcid.org/0000-0003-3577-8667"
title: "nsbm"
version: 1.0.0
doi: 10.5281/zenodo.5045445
date-released: 2021-06-30
url: "https://github.com/fvalle1/nsbm"

GitHub Events

Total
  • Release event: 1
  • Push event: 2
  • Create event: 1
Last Year
  • Release event: 1
  • Push event: 2
  • Create event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 148
  • Total Committers: 4
  • Avg Commits per committer: 37.0
  • Development Distribution Score (DDS): 0.486
Past Year
  • Commits: 11
  • Committers: 3
  • Avg Commits per committer: 3.667
  • Development Distribution Score (DDS): 0.273
Top Committers
Name Email Commits
Filippo Valle f****e@t****t 76
Filippo Valle f****e@u****t 36
Filippo Valle f****e@e****t 33
Filippo Valle f****e@t****t 3
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: over 2 years ago

All Time
  • Total issues: 0
  • Total pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • fvalle1 (4)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 7
conda-forge.org: nsbm

Package to run n-partite Stocastich Block Modeling.

  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent repos count: 34.0%
Average: 50.5%
Dependent packages count: 51.2%
Forks count: 54.2%
Stargazers count: 62.4%
Last synced: 5 months ago

Dependencies

setup.py pypi
  • cloudpickle *
  • matplotlib *
  • numpy *
  • pandas *
.github/workflows/docker.yml actions
  • actions/checkout v2 composite
.github/workflows/miniconda.yml actions
  • actions/checkout v2 composite
  • conda-incubator/setup-miniconda v2 composite
.github/workflows/python-package.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
Dockerfile docker
  • jupyter/datascience-notebook latest build
environment.yml pypi
  • cloudpickle *
  • pandas *