Commits

dan mackinlay committed 2c79283

progress indicator

  • Participants
  • Parent commits 4337939

Comments (0)

Files changed (1)

 import pyentropy
 from random import sample
 import itertools
+from pprint import pprint
 
 # we expect params to contain the following keys:
 # n_agents, dt, noise, radius, steps
     'noise': 0.2,
     'radius': 0.05,
     'discard_steps': 100,
-    'branch_steps': 1,
+    'branch_steps': 10,
     'n_branches': 100,
 }
 
-def swept_experiment(sweepables=None, base_params=DEFAULT_TRIAL_PARAMS, oversample=1, start_seed=10000, n_pairs=10):
+def swept_experiment(sweepables=None, base_params=DEFAULT_TRIAL_PARAMS, oversample=10, start_seed=10000, n_pairs=10):
     sweepables = sweepables or {} #cast to empty dict
     swept_names = sweepables.keys()
     swept_iterables = [sweepables[name] for name in swept_names]
     estimates = []
     seed = start_seed
-    for swept_values in itertools.product(*swept_iterables):
+    n_vals = 1
+    for iterable in swept_iterables:
+        n_vals *= len(iterable)
+    for param_i, swept_values in enumerate(itertools.product(*swept_iterables)):
         these_params = base_params.copy()
         these_params.update(zip(swept_names, swept_values))
-        for sample_i in xrange(oversample):
+        print "simulating"
+        pprint(these_params)
+        print "%0.2f %%" % (100.0*param_i/n_vals)
+        for oversample_i in xrange(oversample):
             trial = branched_trial(
                 these_params,
                 seed=seed