tapios / risk-networks

Code for risk networks: a blend of compartmental models, graphs, data assimilation and semi-supervised learning
Other
2 stars 2 forks source link

Soliciting tests #35

Open glwagner opened 4 years ago

glwagner commented 4 years ago

I'm going to put together some tests using pytest.

It's fairly simple: we'll just have a folder called /test, and files named test_* that implement tests according to the pytest style.

I'll put in basic unit tests that ensure that critical functions runs, and some "regression" style tests that ensure output is reproducible.

However, we will also need tests that ensure behavior is correct. These are more difficult to come up with. We can discuss ideas on this issue. A few ideas:

lubo93 commented 4 years ago

One possible test for the fraction of active edges is to make a comparison with the analytical solution: mean fraction of active edges = lambda(t)/( lambda(t) + mu ).

glwagner commented 4 years ago

@lubo93 and for this test we run the ContactSimulator with no temporal modulation, correct? This should be easy.

glwagner commented 4 years ago

To generate simple networks for tests we can use the following code courtesy of Dr. Boettcher (@lubo93 ):

import networkx as nx

# seed random number generators in *both* numpy.random and random

nodes = 500
attachment = 2

contact_network = nx.barabasi_albert_graph(nodes, attachment)

This generates a graph using the Barbasi-Albert model.