1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import sys
from ml import ml
from ml2 import ml2
from ml3 import ml3
import numpy as np
from cPickle import load
from itertools import product
from math import exp
import time
if __name__ == "__main__":
time.sleep(3)
if len(sys.argv) < 2:
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(.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)
# print "\t".join(map(str, [alpha, delta, lmbda, roots, ll]))
# fh.write("\t".join(map(str, [alpha, delta, lmbda, roots, ll])) + "\n")
# fh.flush()
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]))
|