Science Score: 67.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
Found 2 DOI reference(s) in README -
✓Academic publication links
Links to: aps.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.8%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: oscarcapote
- License: gpl-3.0
- Language: Jupyter Notebook
- Default Branch: master
- Size: 6.29 MB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.md
BiMMSBM
A Python library for implementing Mixed-Membership Stochastic Block Models (MMSBM) with metadata integration for bipartite network analysis and link prediction.
Overview
This library provides tools for finding membership factors and connection probabilities in bipartite networks by incorporating node metadata. It implements the Mixed-Membership Stochastic Block Model (MMSBM) to find the most plausible parameters that fit a dataset of links between nodes, with the ability to leverage user metadata for improved link prediction.
Features
- Bipartite network analysis with metadata integration
- Bayesian inference using Expectation Maximization (EM) algorithm
- Adaptive metadata importance through hyperparameters
- High-performance implementation with optional Numba acceleration
Installation of requirements
bash
pip install -r requirements.txt
Requirements
- Python >= 3.5
- Required packages:
- pandas
- numpy
- Optional but highly recommended:
- numba (for performance optimization)
Usage
The library can be used for link prediction in bipartite complex networks where you have: - Two types of nodes (e.g., users and items, politicians and bills) - Labeled links representing ratings, votes, preferences, or connections - Optional node metadata/attributes
Basic Example
```python import pandas as pd import BiMMSBM as sbm
Create a sample dataset
dfpoliticians = pd.DataFrame({ "legislator": ["Pedro", "Santiago", "Alberto", "Yolanda"], "Party": ["PSOE", "VOX", "PP", "Sumar"], "Moviespreferences": ["Action|Drama", "Belic", "Belic|Comedy", "Comedy|Drama"] })
Initialize nodes layer with 9 groups
politicians = sbm.nodeslayer(9, "legislator", dfpoliticians)
Add exclusive metadata (Party)
lambdaparty = 100 parties = politicians.addexclusivemetadata(lambdaparty, "Party")
Add inclusive metadata (Movie preferences)
lambdamovies = 0.3 Taumovies = 6 movies = politicians.addinclusivemetadata(lambdamovies, "Moviespreferences", Tau_movies)
Dataframe of bills
df_bills =pd.DataFrame( {"bill":["A", "B", "C","D"], "Year":[2020, 2020, 2021, 2022]})
Number of groups
K = 2
Creating the bills layer
bills = sbm.nodeslayer(K,"bill",dfbills)
Dataframe of votes
df_votes =pd.DataFrame( {"legislator":["Pedro","Pedro","Pedro","Santiago","Santiago","Santiago", "Alberto", "Alberto", "Alberto", "Yolanda", "Yolanda", "Yolanda"], "bill":["A", "B", "D", "A","C", "D", "A", "B", "C", "B","C", "D",], "votes":["Yes","No","No", "No","Yes","Yes", "No","No","Yes", "Yes","No","No"]})
Creating the BiNet object
votes = sbm.BiNet(dfvotes,"votes",nodesa=bills,nodesb=politicians) #Fitting the model ## Initialize the EM algorithm by generating the parameters votes.initEM()
## Running the EM algorithm for 100 iterations and check the convergence every 10 steps for i in range(100): votes.EM_step() if i % 10 == 0: converges = votes.converges() print(f"Iteration {i} - Convergence: {converges}") if converges: break
#Getting the accuracy print(f"Accuracy: {votes.get_accuracy()}") ```
How It Works
The Link Prediction Problem
The library solves the link prediction problem in bipartite complex networks using the Mixed-Membership Stochastic Block Model. This model assumes that: - Nodes belong to a superposition of groups - Connection probabilities depend on the groups to which nodes belong

Metadata Integration
The model can be extended to handle multipartite complex networks by incorporating metadata bipartite networks. Each metadata network is described using a MMSBM, allowing for: - Full metadata correlation - Partial metadata correlation - No metadata correlation

The importance of each metadata type is controlled by a hyperparameter:

Documentation
- Full documentation: https://oscarcapote.github.io/BiMMSBM/index.html
- Tutorial: See
Tutorial.ipynb - Example usage: See
Example.ipynb
References
- Accurate and scalable social recommendation using mixed-membership stochastic block models
- Node Metadata Can Produce Predictability Crossovers in Network Inference Problems
License
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
The GNU GPL is a free, copyleft license that ensures the software remains free and open source. It requires that any derivative works must also be distributed under the same license terms.
Author
Oscar Fajardo Fontiveros
Owner
- Name: Oscar Fajardo Fontiveros
- Login: oscarcapote
- Kind: user
- Company: SeesLab
- Repositories: 2
- Profile: https://github.com/oscarcapote
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: BiMMSBM
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Oscar
family-names: Fajardo Fontiveros
email: oscarcapote@hotmail.es
orcid: 'https://orcid.org/0000-0002-0705-8972'
identifiers:
- type: url
value: 'https://github.com/oscarcapote/BiMMSBM'
description: Repository of the library
repository-code: 'https://github.com/oscarcapote/BiMMSBM'
url: 'https://oscarcapote.github.io/BiMMSBM/'
abstract: >-
This library computes the parameters of a Mixed Membership
Stochastic Block model in a bipartite network
keywords:
- Complex Networks
- Networks
- Bayesian Inference
- Block Models
- Stochastick Block Model
license: GPL-3.0
version: '1.0'
date-released: '2025-06-12'
GitHub Events
Total
- Push event: 18
- Create event: 1
Last Year
- Push event: 18
- Create event: 1