Physics, Data Science, Least Squares, Chemometrics, Spectroscopy.
libraries. As for example with SciPy: import scipy.optimize as optimization x0 = np.array([1,1,1]) def func(params, xdata, ydata): return (ydata - np.dot(xdata.T, params))**2 optimization.leastsq(func, x0, args=(components, query_spectra))[0] or with Scikit-learn: import sklearn.linear_model as