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.2.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.2-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: groupmultiness-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 952cb94ff74677b78c64fc1fcbe0920e8f654e47f1360754e17da206d5c71aaa
MD5 b813899828a2919c9d532595daf13c46
BLAKE2b-256 d546ac907c26e8d3d943cd3e13c1903959de77f047caf9ed75adea1dba6143b4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: groupmultiness-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d3321035e53114ecd48b722ad6b85c6caef2ce4062e34328e808a2f2689c786d
MD5 4fc7fe27b42e97e2a58cc1232d826683
BLAKE2b-256 f2cca35453a6de9e8a9ec86191c0247589bb04b0f480b143e4e0795a66ccaa6a

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