Skip to main content

GroupMultiNeSS package

Project description

GroupMultiNeSS

GroupMultiNeSS is a package for statistical modeling of multilayer networks. It implements multiple approaches allowing to extract shared, group, and individual latent structures from a collection of networks on a shared set of nodes. Specifically, it contains the implementation of fitting sampling procedures for the following models:

  • GroupMultiNeSS [Kagan et al. (2025)] - likelihood based approach with nuclear norm penalization, accounts for the additional group latent structure
  • MultiNeSS [MacDonald et al. (2021)] - likelihood based approach with nuclear norm penalization
  • MultiNeSS [Tian et al. (2024)] - likelihood based approach with pre-estimation of latent ranks via Shared Space Hunting algorithm
  • COSIE (Arroyo et al.) - spectral-based Multiple Adjacency Spectral Embedding algorithm

Installation

Use the package manager pip to install GroupMultiNeSS.

pip install GroupMultiNeSS

Usage

# Imports
import numpy as np
from GroupMultiNeSS.group_multiness import GroupMultiNeSS
from GroupMultiNeSS.data_generation import GroupLatentPositionGenerator
from GroupMultiNeSS.utils import make_group_indices


# Sample true latent positions and group indices
n, M, K = 200, 16, 4
group_props = np.ones(K) / K  # make ballanced groups
group_indices = make_group_indices(group_props, M)

lpg = GroupLatentPositionGenerator(n_nodes=n, n_layers=M, group_indices=group_indices)
lpg.generate(random_seed=1)

As, Ps_true, S_true, Qs_true, Rs_true = lpg.As, lpg.Ps, lpg.S, lpg.Qs, lpg.Rs

# Fit GroupMultiNeSS model and compute the relative errors with ground-truth
group_multiness = GroupMultiNeSS(group_indices, n_jobs=K)
group_multiness.fit(As, lr=0.8)
print(group_multiness.make_final_error_report(S_true, Qs_true, Rs_true, Ps=Ps_true))

# {'Shared component': 0.026, 'Group components': 0.051, 'Individual components': 0.122, 'Ps': 0.077}

License

MIT License

Copyright (c) 2024 Alexander Kagan

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

groupmultiness-0.0.3.tar.gz (28.6 kB view details)

Uploaded Source

Built Distribution

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

groupmultiness-0.0.3-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

Details for the file groupmultiness-0.0.3.tar.gz.

File metadata

  • Download URL: groupmultiness-0.0.3.tar.gz
  • Upload date:
  • Size: 28.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for groupmultiness-0.0.3.tar.gz
Algorithm Hash digest
SHA256 af57fac02d3c1c92b0333875bb287dfb4c2f0e6b92102e2ebac80a86d394d462
MD5 c27ab49f63b4b9e09d761f3ba4ba63b0
BLAKE2b-256 0928e45f1b51e01666167e003cfc794e0221a7700c7057de234177648f6eac10

See more details on using hashes here.

File details

Details for the file groupmultiness-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: groupmultiness-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 33.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for groupmultiness-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9fd63a1b71877b2acd9c40dd4134c41e060eed08ae6f21f18063e9b3aef00e4c
MD5 1b63f9bbbfd9b5a4c4347aa05f3a5655
BLAKE2b-256 55bf6c3685b60b828499bd4a869b237398e0b75ce758726131feeca75614d846

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