Modular Machine Learning with Applications to Genetic Circuit Composition