Continuous-time threshold model (CNTM)
Detailed information about the CNTM can be found here.
CNTMParameters(network, r, r_tilde, threshold_01, threshold_10)
dataclass
Container for the parameters of the Threshold Model.
At the rate r, each node evaluates to change their opinion from its current opinion m=0,1 to the other opinion n=1-m. It changes the opinion if the percentage of neighbors of opinion n exceeds the threshold_mn.
Additionally, each node changes its state randomly at rate r_tilde (noise).
CNTM(params)
Continuous-time Noisy Threshold Model.
Parameters:
-
params(CNTMParameters) –
Source code in sponet/cntm/model.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
simulate(t_max, x_init=None, t_eval=None, rng=default_rng())
Simulate the model from t=0 to t=t_max.
Parameters:
-
t_max(float) – -
x_init(ArrayLike, default:None) –shape=(num_agents,)
-
t_eval(ArrayLike, default:None) –Array of time points where the solution should be saved, or number "n" in which case the solution is stored equidistantly at "n" time points. If None, store every snapshot.
-
rng(Generator, default:default_rng()) –random number generator
Returns:
-
tuple[NDArray, NDArray]–t_traj (shape=(?,)), x_traj (shape=(?,num_agents))
Source code in sponet/cntm/model.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |