What it does
Groups loans that match certain criteria into pools, maximizing the total value of pools and the loans in it (preferring higher valued pools over lower valued ones).
How we built it
We used Python, because it has many powerful data analysis libraries like Pandas/numpy, that could get through the large dataset quickly.
We first group the data by loan_term, maturity_date, and then take a subset of each group that satisfies each class's condition, using it to make groups via a round-robin algorithm (that ensures state distribution's are equal and will eventually satisfy the state max % requirement).
Every loan that is not matched to a pool is then recycled, so that it might be used by the next pool class of loans.
This process then continues for all the groups.
The library matplotlib was used to plot the loan data, showing us important insights such as the fact that the loan distribution among states was not equal (which is something we are planning on exploring in optimizing our solution).
Challenges we ran into
Coming up with the solution was hard, since our pipeline to process the data had a ton of stages (to filter/group the data), and it was tricky to make everything work together.
Making the round robin algorithm work.
Accomplishments that we're proud of
Being able to process the entire dataset (our first attempts took several minutes to get through the dataset).
Putting together a small test suite that checked that the pool satisfied the criteria, and scored our algorithm, which allowed us to make sure changes were improvements.
What we learned
What knapsack algorithms are.
What's next for Fannie Mae Loan Solution
Further optimizations (optimize the round robin algorithm to output pools with state percentages closer to the maximum, so that we can fit in more loans, since the state distribution is not uniform).
Show me the Code
The code can be found in new_solution.ipynb.
You will need Jupyter, Matplotlib, Pandas, Numpy, and a Python version > 3.6 to run it.
Generated pool files are in the output folder.
Log in or sign up for Devpost to join the conversation.