1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import sys
from ml import ml
import numpy as np
from cPickle import load
from itertools import product
from math import exp
if __name__ == "__main__":
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]))
alpha = 1. / np.arange(1., 1000., 100.) # parameter of the time component
delta = np.arange(0.01, 0.9, 0.1) # parameter of the structural component
with open("out.log", "w") as fh:
for a, d in product(alpha, delta):
beta, roots, ll = ml(root_victims, victims, non_victims, age, a, d)
print "\t".join(map(str, [a, d, beta, roots, ll, exp(ll)]))
fh.write("\t".join(map(str, [a, d, beta, roots, ll])) + "\n")
fh.flush()
|