The answer to the SMM exercise can be found at
smm_gradient_descent_ans.py smm_monte_carlo_ans.py
And here is a template for a tcsh script to run nested-cross-validation doit_nested_CV