import sys from ml import ml import numpy as np from cPickle import load from itertools import product from math import exp def print_ll(alpha, delta): beta, roots, ll = ml(root_victims, victims, non_victims, alpha, delta) print "\t".join(map(str, [alpha, delta, beta, roots, ll, exp(ll)])) + "\n" if __name__ == "__main__": if len(sys.argv) < 2: sys.exit("usage: {0} ".format(sys.argv[0])) root_victims, victims, non_victims, age = load(open(sys.argv[1])) alpha = 1. / np.arange(1., 1000., 10.) # parameter of the time component delta = np.arange(0.01, 0.9, 0.03) # parameter of the structural component with open("out.log", "a") as fh: for a, d in product(alpha, delta): beta, roots, ll = ml(root_victims, victims, non_victims, age, a, d) print beta fh.write("\t".join(map(str, [a, d, beta, roots, ll])) + "\n") fh.flush()