# How to minimize Nelson-Siegel parametric form

Problem
I am given the following function to minimize (w.r.t. $$\theta$$) $$f= \sum_{k=1}^5 \Big [ \sum_{i=1}^{N_k} CF_{k, i} \cdot e^{-r(t_{k, i}, \theta)\cdot t_{k, i}} - P_k^* \Big]^2$$ where $$\theta = (\beta_0, \beta_1, \beta_2, \lambda)$$ and $$r(t, \theta) = \beta_0 + \beta_1 \big(\frac{1-e^{-\frac{t}{\lambda}}}{\frac{t}{\lambda}} \big) + \beta_2 \big(\frac{1-e^{-\frac{t}{\lambda}}}{\frac{t}{\lambda}} - e^{-\frac{t}{\lambda}} \big)$$

Context
We are given 5 bonds, their cashflows, $$CF_{k, i}$$, and market price, $$P_k^*$$. All these values are given to us as numbers.

My attempt
I tried to apply Newton's Method using python. However, I am pretty sure that this method is not applicable here, and I need another minimization algorithm.

Could anyone suggest which algorithm is the best for such a function? ?