模型擬合是科學計算的一部分,它可以幫助我們找出所研究的系統具有哪些屬性。這些系統可能是工程系統或是最近在機器學習中越來越常使用的概念系統。最小二乘法是一個經典且廣為人知的技術來幫助我們建立模型擬合到我們所得到的數據。在本文中,我們使用了幾種算法來研究如何解決最小二乘問題,例如最速下降法、有限內存 Broyden-Fletcher-Goldfarb-Shanno(LBFGS)、Gauss-Newton 方法(GN)、Levenberg-Marquardt 方法(LM) 和非線性廣義極小殘差(N-GMRES)與最速下降預處理。對於機器學習問題中的二元分類,我們有線性和非線性最小二乘分類器兩種模型,通過訓練精度來比較性能。 根據我們在求解測試問題、識別彈簧系統參數、鳶尾花和MNIST數據集的二元分類中獲得的數值結果。我們對如何解決最小二乘問題進行了具體討論。並且非線性最小二乘分類器模型在分類問題上有更好的表現。;Data fitting is part of scientific computing which can help us find out what properties the investigated system has. These systems might be engineering systems or conceptual systems that are used in machine learning more frequently. Least squares is the classic and widely known technique for fitting model to data. In this thesis, we use several algorithms to study how we solve the least square problem, such as Steepest descent method, Limited-memory Broyden–Fletcher–Goldfarb–Shanno (LBFGS), Gauss-Newton method (GN), Levenberg–Marquardt method (LM) and nonlinear generalized minimal residual (N-GMRES) with steepest descent preconditioning. And for binary classification in machine learning problems, we have linear and nonlinear least squares classifier two models to compare the performance by the training accuracy. With the numerical result we obtain in solving test problems, parameter identification of spring-mass system, and binary classification of Iris flowers and MNIST data set. We have a specific discussion on how we solve the least-squares problems. And the nonlinear least squares classifier model have the better performance in classification problem.