Principled model selection for stochastic dynamics