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} ".format(sys.argv[0])) root_victims, victims, non_victims, age = load(open(sys.argv[1])) # alphas = 1. / np.arange(1., 2000., 30.) # parameter of the time component alphas = np.logspace(-3,-.1,num=50) # deltas = np.arange(0.005, 0.5, 0.005) # parameter of the structural component deltas = np.logspace(-3,-.5,num=50) 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, [alpha, delta, beta, roots, ll])) fh.write("\t".join(map(str, [alpha, delta, beta, roots, ll])) + "\n") fh.flush() # alpha = 1/10. # delta = .5 # beta, roots, ll = ml(root_victims, victims, non_victims, age, alpha, delta) # print "\t".join(map(str, [1./alpha, delta, beta, roots, ll]))