{"id":32175733,"url":"https://github.com/fvalle1/nsbm","last_synced_at":"2026-02-19T08:34:25.996Z","repository":{"id":42184668,"uuid":"333831359","full_name":"fvalle1/nsbm","owner":"fvalle1","description":"nSBM: multi branch topic modeling","archived":false,"fork":false,"pushed_at":"2025-09-02T08:36:11.000Z","size":17138,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-26T22:23:01.069Z","etag":null,"topics":["hacktoberfest","hacktoberfest-accepted","hacktoberfest2022","hacktoberfest2024","natural-language-processing","python","stochastic-simulation-algorithm","topic-modeling"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fvalle1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-01-28T17:21:02.000Z","updated_at":"2024-10-11T09:22:26.000Z","dependencies_parsed_at":"2024-11-06T12:20:09.323Z","dependency_job_id":"ba1ebbc3-b368-4545-a6d2-d6e747283e75","html_url":"https://github.com/fvalle1/nsbm","commit_stats":{"total_commits":148,"total_committers":4,"mean_commits":37.0,"dds":0.4864864864864865,"last_synced_commit":"049cb7096019307f3456c64f36c0c8dbd1295c47"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/fvalle1/nsbm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvalle1%2Fnsbm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvalle1%2Fnsbm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvalle1%2Fnsbm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvalle1%2Fnsbm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fvalle1","download_url":"https://codeload.github.com/fvalle1/nsbm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fvalle1%2Fnsbm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29608558,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","hacktoberfest-accepted","hacktoberfest2022","hacktoberfest2024","natural-language-processing","python","stochastic-simulation-algorithm","topic-modeling"],"created_at":"2025-10-21T19:46:33.863Z","updated_at":"2026-02-19T08:34:25.992Z","avatar_url":"https://github.com/fvalle1.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![DOI](https://zenodo.org/badge/333831359.svg)](https://zenodo.org/badge/latestdoi/333831359)\n[![Documentation Status](https://readthedocs.org/projects/trisbm/badge/?version=latest)](https://trisbm.readthedocs.io/en/latest/?badge=latest)\n[![Python package](https://github.com/fvalle1/trisbm/actions/workflows/python-package.yml/badge.svg)](https://github.com/fvalle1/trisbm/actions/workflows/python-package.yml)\n[![Conda test](https://github.com/fvalle1/nsbm/actions/workflows/miniconda.yml/badge.svg)](https://github.com/fvalle1/nsbm/actions/workflows/miniconda.yml)\n[![Docker](https://github.com/fvalle1/trisbm/actions/workflows/docker.yml/badge.svg)](https://github.com/fvalle1/trisbm/actions/workflows/docker.yml)\n[![GPL](https://anaconda.org/conda-forge/nsbm/badges/license.svg\n)](LICENSE)\n\n# multipartite Stochastic Block Modeling\n\nInheriting hSBM from [https://github.com/martingerlach/hSBM_Topicmodel](https://github.com/martingerlach/hSBM_Topicmodel) extends it to tripartite networks (aka supervised topic models)\n\nThe idea is to run SBM-based topic modeling on networks given keywords on documents\n\n![network](network.png)\n\n# Install\n## With pip\n```bash\npython3 -m pip install . -vv\n```\n\n\n## With conda/mamba\n\n```bash\nconda install -c conda-forge nsbm\n```\n\n\n# Example\n```python\nfrom nsbm import nsbm\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\nindex = [\"w{}\".format(w) for w in range(1000)],\ncolumns = [\"doc{}\".format(d) for d in range(250)],\ndata = np.random.randint(1, 100, 250000).reshape((1000, 250)))\n\ndf_key_list = []\n\n## keywords\ndf_key_list.append(\n    pd.DataFrame(\n    index = [\"keyword{}\".format(w) for w in range(100)],\n    columns = [\"doc{}\".format(d) for d in range(250)],\n    data = np.random.randint(1, 10, (100, 250)))\n)\n    \n## authors\ndf_key_list.append(\n    pd.DataFrame(\n    index = [\"author{}\".format(w) for w in range(10)],\n    columns = [\"doc{}\".format(d) for d in range(250)],\n    data = np.random.randint(1, 5, (10, 250)))\n)\n    \n## other features\ndf_key_list.append(\n    pd.DataFrame(\n    index = [\"feature{}\".format(w) for w in range(25)],\n    columns = [\"doc{}\".format(d) for d in range(250)],\n    data = np.random.randint(1, 5, (25, 250)))\n)\n\nmodel = nsbm()\nmodel.make_graph_multiple_df(df, df_key_list)\n\nmodel.fit(n_init=1, B_min=50, verbose=False)\nmodel.save_data()\n```\n\n\n# Run with Docker\n\n```bash\ndocker run -it -u jovyan -v $PWD:/home/jovyan/work -p 8899:8888 docker.pkg.github.com/fvalle1/trisbm/trisbm:latest\n```\n\nIf a *graph.xml.gz* file is found in the current dir the analysis will be performed on it.\n\n# Tests\n\n```bash\npython3 tests/run_tests.py\n```\n\n# Caveats\n\nPlease check this stuff in your data:\n- there should be no zero-degree nodes (all nodes should have at least one link)\n- there shouldn't be any duplicate node\n- The `make_form_BoW_df` function discretises the data\n\n# Documentation\n\n[Docs](https://fvalle1.github.io/nsbm/)\n\n[Readthedocs](https://trisbm.readthedocs.io/en/latest/index.html)\n\n# License\n\nSee [LICENSE](LICENSE).\n\nThis work [is in part based on](https://www.gnu.org/licenses/gpl-faq.en.html#WhyDoesTheGPLPermitUsersToPublishTheirModifiedVersions) [sbmtm](https://github.com/martingerlach/hSBM_Topicmodel)\n\n## Third party libraries\n\nThis package depends on [graph-tool](https://graph-tool.skewed.de)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffvalle1%2Fnsbm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffvalle1%2Fnsbm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffvalle1%2Fnsbm/lists"}