Skip to content

Commit

Permalink
Redo Fig. 1b (#9)
Browse files Browse the repository at this point in the history
* Redo Fig. 1b

* updates

* update

* Update utilities.py

* improve readability
  • Loading branch information
nwlandry authored Nov 6, 2023
1 parent ef8e947 commit c056da3
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 63 deletions.
Binary file added Figures/contagion_inference.pdf
Binary file not shown.
Binary file added Figures/contagion_inference.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions lcs/utilities.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import random

import numpy as np
from scipy.stats import gaussian_kde

from .contagion import *
from .inference import *
Expand Down Expand Up @@ -66,9 +67,9 @@ def degrees(A):

def powerlaw(n, minval, maxval, r):
u = np.random.random(n)
return (minval ** (1 - r) + u * (maxval ** (1 - r) - minval ** (1 - r))) ** (
1 / (1 - r)
)
a = minval ** (1 - r)
b = maxval ** (1 - r)
return (a + u * (b - a)) ** (1 / (1 - r))


def mean_power_law(minval, maxval, r):
Expand Down
164 changes: 105 additions & 59 deletions plot_infer_contagion_functions.ipynb

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ networkx>=3.0
matplotlib
numba
pytest
xgi
xgi
arviz

0 comments on commit c056da3

Please sign in to comment.