Building flexible machine learning libraries adapted for Netflix’s use cases is paramount in our continued efforts to better model user behaviors and provide great personalized recommendations. This talk introduces one such scala-based DSL library to aid “User Training Set Stratification” in our offline machine learning workflows. Originally created to improve user stratification while building our fact store, the library has evolved to cater to other general-purpose stratification use cases in our ML applications. We will talk about how using the library’s scala-based DSL and its underlying Apache Spark based implementation, one can easily express and dynamically generate the required training data sets for different ML experiment needs by specifying the desired distributions of user attributes such as country, tenure, play frequency etc. The demo section of the talk will showcase how we were to able to utilize idiomatic scala with several API examples in a Zeppelin notebook.