Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CS random seed error #141

Merged
merged 1 commit into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cs-config/cs_config/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import pandas as pd
import numpy as np
from collections import defaultdict
from taxbrain.report_utils import convert_params
from taxcalc import (Policy, DIFF_TABLE_COLUMNS, DIFF_TABLE_LABELS,
DIST_TABLE_COLUMNS, DIST_TABLE_LABELS,
add_income_table_row_variable,
Expand All @@ -31,7 +32,6 @@
TCDIR = os.path.dirname(TCPATH)



def random_seed(user_mods, year):
"""
Compute random seed based on specified user_mods, which is a
Expand Down Expand Up @@ -67,7 +67,10 @@ def random_seed_from_subdict(subdict):
user_mods_copy["behavior"] = beh_mods_dict
ans = 0
for subdict_name in user_mods_copy:
ans += random_seed_from_subdict(user_mods_copy[subdict_name])
subdict = user_mods_copy[subdict_name]
if subdict_name == "policy":
subdict = convert_params(subdict)
ans += random_seed_from_subdict(subdict)
return ans % np.iinfo(np.uint32).max


Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ dependencies:
- matplotlib
- pip:
- cs-kit
- cs2tc