Training and deploying models with built-in algorithms