Optimization Function Machine Learning Models In Python