SciPy - Curve Fitting and Regression
Given the code below, what will be the output of
print(popt)?
import numpy as np
from scipy.optimize import curve_fit
def linear_model(x, m, c):
return m * x + c
xdata = np.array([0, 1, 2, 3, 4])
ydata = np.array([1, 3, 5, 7, 9])
popt, _ = curve_fit(linear_model, xdata, ydata, p0=[1, 0])
print(popt)