Machine learning (ML) has achieved many remarkable advances and successes in numerous areas. However, it is difficult for programmers to maintain, reuse, and extend ML programs. In particular, ML programs often come with a wide range of configurable options. As a result, programmers often need to define a family of programs. Currently they do this in an ad-hoc way, causing a significant amount of code duplication.
We study ML programming from a language design perspective. We propose a new choice-based learning paradigm which provides a separation of concerns that fosters modularity. The key insight underlying our design of choice-based learning is to combine two programming techniques: algebraic effects and handlers, and loss continuations. We establish the semantics of our design, implement our design as an effect handler library in Haskell, and provide various learning examples.