Skip to content

Commit

Permalink
added file dictionary to prediction file
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddhartha Jagannath committed Oct 31, 2020
1 parent d734ceb commit 86d5970
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/prediction/voter_turnout_prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,26 @@ class StatePredictor(object):
'../../voteByMail2016.xls'),
2014: os.path.join(os.path.dirname(__file__),
'../../voteByMail2014.xls'),


2012: os.path.join(os.path.dirname(__file__),
'../../voteByMail2012.xlsx'),
}

FAMILY_STRUCTURE_BY_STATE = {
2008: os.path.join(os.path.dirname(__file__),
'../../data/structure2008.csv'),
2010: os.path.join(os.path.dirname(__file__),
'../../data/structure2010.csv'),
2012: os.path.join(os.path.dirname(__file__),
'../../data/structure2012.csv'),
2014: os.path.join(os.path.dirname(__file__),
'../../data/structure2014.csv'),
2016: os.path.join(os.path.dirname(__file__),
'../../data/structure2016.csv'),
2018: os.path.join(os.path.dirname(__file__),
'../../data/structure2018.csv')
}

RANDOM_SEED = 42

Expand Down Expand Up @@ -218,6 +235,10 @@ def __init__(self, label_col='VoterTurnout'):
self.log.info("Adding age distribution by State...")
election_features = PopulationAgeTransformer(self.AGE_BY_STATE).fit_transform(election_features)
self.log.info("Done adding age distribution by State.")

self.log.info("Population Distribution by Family Structure by State...")
election_features = familyStructureTransformer(self.FAMILY_STRUCTURE_BY_STATE).fit_transform(election_features)
self.log.info("Done Adding Population Distribution by Family Structure by State")

# Remove columns not needed, and encode
# categorical columns:
Expand Down

0 comments on commit 86d5970

Please sign in to comment.