Skip to content

Commit

Permalink
latest reg tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jdebacker committed Nov 6, 2018
1 parent cfb5fe8 commit 8543da9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
27 changes: 14 additions & 13 deletions regression/run_reg_reforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,15 @@ def run_micro_macro(user_params, reform=None, baseline_dir=BASELINE_DIR,
------------------------------------------------------------------------
'''
print('path exists', not os.path.exists(baseline_dir), ok_to_run_baseline)
if not os.path.exists(baseline_dir) and ok_to_run_baseline:
# if not os.path.exists(baseline_dir) and ok_to_run_baseline:
if ok_to_run_baseline:
output_base = baseline_dir
input_dir = baseline_dir
kwargs={'output_base':baseline_dir, 'baseline_dir':baseline_dir,
'test':False, 'time_path':True, 'baseline':True,
'analytical_mtrs':False, 'age_specific':True,
'user_params':user_params,'guid':'baseline',
'run_micro':True, 'small_open': False, 'budget_balance':False,
'run_micro':False, 'small_open': False, 'budget_balance':False,
'baseline_spending':False, 'data': data}
#p1 = Process(target=runner, kwargs=kwargs)
#p1.start()
Expand All @@ -143,21 +144,21 @@ def run_micro_macro(user_params, reform=None, baseline_dir=BASELINE_DIR,

ans = postprocess.create_diff(baseline_dir=baseline_dir, policy_dir=reform_dir)

print "total time was ", (time.time() - start_time)
print 'Percentage changes in aggregates:', ans
print("total time was ", (time.time() - start_time))
print('Percentage changes in aggregates:', ans)


def run_reforms(ref_idxs=REF_IDXS, path_prefix="", cpu_count=CPU_COUNT,
data=DATA):
# make sure we have a baseline result before other reforms are run
# ok_to_run_baseline = True
# run_micro_macro({},
# reforms[0],
# "./{0}OUTPUT_BASELINE".format(path_prefix),
# "./{0}OUTPUT_REFORM_{1}".format(path_prefix, 0),
# str(0),
# data,
# ok_to_run_baseline,)
ok_to_run_baseline = True
run_micro_macro({},
reforms[0],
"./{0}OUTPUT_BASELINE".format(path_prefix),
"./{0}OUTPUT_REFORM_{1}".format(path_prefix, 0),
str(0),
data,
ok_to_run_baseline,)
# run reforms in parallel
pool = Pool(processes=cpu_count)
# results = []
Expand Down Expand Up @@ -185,7 +186,7 @@ def run_reforms(ref_idxs=REF_IDXS, path_prefix="", cpu_count=CPU_COUNT,
results = []

ok_to_run_baseline = False
for i in range(0, len(reforms)):
for i in range(1, len(reforms)):
args = ({},
reforms[i],
"./{0}OUTPUT_BASELINE".format(path_prefix),
Expand Down
2 changes: 1 addition & 1 deletion regression/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
REG_BASELINE = os.path.join(CURDIR, 'regression_results/REG_OUTPUT_BASELINE')
REG_REFORM = os.path.join(CURDIR, 'regression_results/REG_OUTPUT_REFORM_{ref_idx}')
# REF_IDXS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
REF_IDXS = [0, 1, 2]
REF_IDXS = [0, 1, 2, 3, 4, 5, 6, 7]

BASELINE = os.path.join(CURDIR, 'OUTPUT_BASELINE')
REFORM = os.path.join(CURDIR, 'OUTPUT_REFORM_{ref_idx}')
Expand Down

0 comments on commit 8543da9

Please sign in to comment.