summaryrefslogtreecommitdiffstats
path: root/experiments/process.py
blob: 1b84d35ed7ca615dce55f6519d5f7bc3727e06d9 (plain)
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
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]))
    
    # alphas = 1. / np.arange(1000., 10000., 50.)  # parameter of the time component
    # deltas = np.arange(0.01, 0.5, 0.03)  # parameter of the structural component
    # with open("out.log", "w") as fh:
    #     for alpha, delta in product(alphas, deltas):
    #         beta, roots, ll = ml(root_victims, victims, non_victims, age, alpha, delta)
    #         print "\t".join(map(str, [1/alpha, delta, beta, roots, ll]))
    #         fh.write("\t".join(map(str, [alpha, delta, beta, roots, ll])) + "\n")
    #         fh.flush()

    alpha = 1/10.
    delta = 0.2
    beta, roots, ll = ml(root_victims, victims, non_victims, age, alpha, delta)
    print "\t".join(map(str, [1./alpha, delta, beta, roots, ll]))