[Machine Learning] Using Google Protocol Buffers for common records

Summary:
Also signficant cleanups to the code

Test Plan:
ghc -Wall *.hs

Reviewers:

CC: