最小二乘学习算法基础

简介: Least Squares Least squares regression is a traditional ML algorithm that minimizes the total square error between samples and learning output, i.e. minimize JLS(θ)=12∑i=1n(fθ(xi)−yi)2J_

Least Squares
Least squares regression is a traditional ML algorithm that minimizes the total square error between samples and learning output, i.e. minimize

JLS(θ)=12i=1n(fθ(xi)yi)2

We’d like to get the estimated θ where JLS is the smallest.
θ^LS=argminθJLS(θ)

Take the linear model as an illustration.
fθ(x)=j=1bθjϕj(x)=θTϕ(x)

Then
JLS(θ)=12Φθy2

where
Φ=ϕ1(x1)ϕ1(xn)ϕb(x1)ϕb(xn)
which is also known as “design matrix”.
It is not necessary to calculate the minimum JLS, but in order to get the corresponding θ, we may take the derivative of JLS(θ), which you have learned in high school.
θJLS=(JLSθ1,,JLSθb)T=ΦTΦθΦTy=0
Then
θ^LS=(ΦTΦ)1ΦTyΦy

where Φ is the general inverse of Φ.
You can also apply weights to the training set:
minθ12i=1nwi(fθ(xi)yi)2
Then
θ^LS=(ΦTWΦ)ΦTWy
.

If we take the kernal model as an example, i.e.

fθ(x)=j=1nθjK(x,xj)
which can also be known as a kind of linear model. For simplicity, We just show the corresponding design matrix
K=K(x1,x1)K(xn,x1)K(x1,xn)K(xn,xn)

Note that least squares algorithm share the property of asymptotic unbiasedness, which means that the noise in y can be removed especially when the expectation of noise equals to zero.

E[θ^LS]=θ.
相关文章
|
2月前
|
算法
基于最小二乘正弦拟合算法的信号校正matlab仿真,校正幅度,频率以及时钟误差,输出SNDR,SFDR,ENOB指标
基于最小二乘正弦拟合算法的信号校正matlab仿真,校正幅度,频率以及时钟误差,输出SNDR,SFDR,ENOB指标
|
7天前
|
机器学习/深度学习 算法 前端开发
Scikit-learn进阶:探索集成学习算法
【4月更文挑战第17天】本文介绍了Scikit-learn中的集成学习算法,包括Bagging(如RandomForest)、Boosting(AdaBoost、GradientBoosting)和Stacking。通过结合多个学习器,集成学习能提高模型性能,减少偏差和方差。文中展示了如何使用Scikit-learn实现这些算法,并提供示例代码,帮助读者理解和应用集成学习提升模型预测准确性。
|
7天前
|
机器学习/深度学习 算法 Python
使用Python实现集成学习算法:Bagging与Boosting
使用Python实现集成学习算法:Bagging与Boosting
18 0
|
14天前
|
算法
【算法学习--字符串】(不含KMP算法)
【算法学习--字符串】(不含KMP算法)
|
1月前
|
Rust Dart 算法
55.3k star!开源算法教程,附带动画图解,学习算法不再苦恼!
55.3k star!开源算法教程,附带动画图解,学习算法不再苦恼!
|
1月前
|
算法 C++ 计算机视觉
Opencv(C++)学习系列---Laplacian拉普拉斯边缘检测算法
Opencv(C++)学习系列---Laplacian拉普拉斯边缘检测算法
|
1月前
|
算法 C++ 计算机视觉
Opencv(C++)学习系列---Canny边缘检测算法
Opencv(C++)学习系列---Canny边缘检测算法
|
1月前
|
算法 Java 索引
【数据结构与算法】4、双向链表(学习 jdk 的 LinkedList 部分源码)
【数据结构与算法】4、双向链表(学习 jdk 的 LinkedList 部分源码)
31 0
|
1月前
|
存储 算法 Java
【数据结构与算法】1、学习动态数组数据结构(基本模拟实现 Java 的 ArrayList 实现增删改查)
【数据结构与算法】1、学习动态数组数据结构(基本模拟实现 Java 的 ArrayList 实现增删改查)
45 0
|
2月前
|
存储 缓存 网络协议
计算机网络:思科实验【3-集线器与交换机的区别、交换机的自学习算法】
计算机网络:思科实验【3-集线器与交换机的区别、交换机的自学习算法】

热门文章

最新文章