Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

bicm

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bicm - npm Package Compare versions

Comparing version
3.2.0
to
3.3.0
+1
-1
bicm.egg-info/PKG-INFO
Metadata-Version: 2.1
Name: bicm
Version: 3.2.0
Version: 3.3.0
Summary: Package for bipartite configuration model

@@ -5,0 +5,0 @@ Home-page: https://github.com/mat701/BiCM

@@ -19,3 +19,3 @@ """

__version__ = "3.2.0"
__version__ = "3.3.0"
__author__ = """Matteo Bruno (matteobruno180@gmail.com)"""

@@ -75,2 +75,66 @@ """

def sample_biwcm_d(x, y=None, exp=False):
"""
Samples the biwcm_d model. Returns a sampled biadjacency matrix.
Works by passing only a avg matrix or directly the fitnesses of both layers.
If exp=True, it supposes that the fitness exponents theta and eta have been passed.
"""
if not isinstance(x, np.ndarray):
x = np.array(x)
if y is not None: # If the avg_mat has been passed
if not isinstance(y, np.ndarray):
y = np.array(y)
if exp: # If the theta_x and eta_y have been passed
x = np.exp(-x)
y = np.exp(-y)
x = biwcm_d_from_fitnesses(x, y)
out_x = np.zeros_like(x, dtype=int)
cols_sum = x.sum(0)
rows_sum = x.sum(1)
if np.any(cols_sum == 0):
good_cols = np.where(cols_sum != 0)[0]
x = x[:, good_cols]
else:
good_cols = np.arange(len(cols_sum))
if np.any(rows_sum == 0):
good_rows = np.where(rows_sum != 0)[0]
x = x[good_rows, :]
else:
good_rows = np.arange(len(rows_sum))
out_x[good_rows[:, None], good_cols] = np.random.geometric(1 / (x - 1)) - 1 # Minus one for correct geometric with n exponent
return out_x
def sample_biwcm_c(x, y=None, exp=False):
"""
Samples the biwcm_c model. Returns a sampled biadjacency matrix.
Works by passing only a avg matrix or directly the fitnesses of both layers.
If exp=True, it supposes that the fitness exponents theta and eta have been passed.
"""
if not isinstance(x, np.ndarray):
x = np.array(x)
if y is not None: # If the avg_mat has been passed
if not isinstance(y, np.ndarray):
y = np.array(y)
if exp: # If the theta_x and eta_y have been passed
x = np.exp(-x)
y = np.exp(-y)
x = biwcm_c_from_fitnesses(x, y)
out_x = np.zeros_like(x)
cols_sum = x.sum(0)
rows_sum = x.sum(1)
if np.any(cols_sum == 0):
good_cols = np.where(cols_sum != 0)[0]
x = x[:, good_cols]
else:
good_cols = np.arange(len(cols_sum))
if np.any(rows_sum == 0):
good_rows = np.where(rows_sum != 0)[0]
x = x[good_rows, :]
else:
good_rows = np.arange(len(rows_sum))
out_x[good_rows[:, None], good_cols] = np.random.exponential(scale=x)
return out_x
def sample_bicm_edgelist(x, y):

@@ -77,0 +141,0 @@ """

Metadata-Version: 2.1
Name: bicm
Version: 3.2.0
Version: 3.3.0
Summary: Package for bipartite configuration model

@@ -5,0 +5,0 @@ Home-page: https://github.com/mat701/BiCM

@@ -8,3 +8,3 @@ import setuptools

name="bicm",
version="3.2.0",
version="3.3.0",
author="Matteo Bruno",

@@ -11,0 +11,0 @@ author_email="matteobruno180@gmail.com",