summaryrefslogtreecommitdiffstats
path: root/experiments/process.py
diff options
context:
space:
mode:
authorBen Green <ben@SEASITs-MacBook-Pro.local>2015-06-25 23:56:26 -0400
committerBen Green <ben@SEASITs-MacBook-Pro.local>2015-06-25 23:56:26 -0400
commit7167a81cfb8b872dd1547e5a8669004b191417db (patch)
treedd160b9a7f438837118d8ca9fe83ae6c35a0d71a /experiments/process.py
parentc8fc620dda6096932707566dc8f20a3e65cb26b0 (diff)
downloadcriminal_cascades-7167a81cfb8b872dd1547e5a8669004b191417db.tar.gz
Worked on process to generate cascades in R, recover them in ml2, and
compare true/recovered. Results look good: ml2 finds close-to-actual parameters and gets ~60% of the infectors right. I will check how many recovery gets in the top 2 or 3 infectors.
Diffstat (limited to 'experiments/process.py')
-rw-r--r--experiments/process.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/experiments/process.py b/experiments/process.py
index 9ea2e81..5f3cff4 100644
--- a/experiments/process.py
+++ b/experiments/process.py
@@ -15,22 +15,22 @@ if __name__ == "__main__":
sys.exit("usage: {0} <file>".format(sys.argv[0]))
root_victims, victims, non_victims, age = load(open(sys.argv[1]))
- # alphas = np.arange(1e-3, 1e-2, 8e-4) # parameter of the time component
- alphas = np.logspace(-3,0,num=15)
- # deltas = np.arange(0.001, 0.3, 0.008) # parameter of the structural component
- deltas = np.logspace(-4,-1.7,num=15)
- with open("out.log", "w") as fh:
- for alpha, delta in product(alphas, deltas):
- beta, roots, ll = ml3(root_victims, victims, non_victims, age, alpha, delta)
- print "\t".join(map(str, [alpha, delta, beta, roots, ll]))
- fh.write("\t".join(map(str, [alpha, delta, beta, roots, ll])) + "\n")
- fh.flush()
-
# # alphas = np.arange(1e-3, 1e-2, 8e-4) # parameter of the time component
- # alphas = np.logspace(-4,-1.5,num=20)
+ # alphas = np.logspace(-3,0,num=15)
# # deltas = np.arange(0.001, 0.3, 0.008) # parameter of the structural component
- # deltas = np.logspace(-4,-2,num=20)
- # lmbda = 1.#np.logspace(-12,-3,num=10)
+ # deltas = np.logspace(-4,-1.7,num=15)
+ # with open("out.log", "w") as fh:
+ # for alpha, delta in product(alphas, deltas):
+ # beta, roots, ll = ml3(root_victims, victims, non_victims, age, alpha, delta)
+ # print "\t".join(map(str, [alpha, delta, beta, roots, ll]))
+ # fh.write("\t".join(map(str, [alpha, delta, beta, roots, ll])) + "\n")
+ # fh.flush()
+
+ # alphas = np.arange(.03, .065, .001) # parameter of the time component
+ # # alphas = np.logspace(-4,-1,num=20)
+ # deltas = np.arange(.09, .11, .001) # parameter of the structural component
+ # # deltas = np.logspace(-2,-.5,num=20)
+ # lmbda = 0.10#np.logspace(-12,-3,num=10)
# with open("out.log", "w") as fh:
# for alpha, delta in product(alphas, deltas):
# lmbda, roots, ll = ml2(root_victims, victims, non_victims, alpha, delta, lmbda)
@@ -38,7 +38,7 @@ if __name__ == "__main__":
# fh.write("\t".join(map(str, [alpha, delta, lmbda, roots, ll])) + "\n")
# fh.flush()
- # alpha = 0.0094
- # delta = 0.0048
- # beta, roots, ll = ml2(root_victims, victims, non_victims, alpha, delta, 1.)
- # print "\t".join(map(str, [alpha, delta, beta, roots, ll])) \ No newline at end of file
+ alpha = 0.041
+ delta = 0.01
+ beta, roots, ll = ml2(root_victims, victims, non_victims, alpha, delta, 1.)
+ print "\t".join(map(str, [alpha, delta, beta, roots, ll])) \ No newline at end of file