多元线性回归模型

所谓的多元,通俗一点讲就是一个数据集中含有多个特征,一元的话就含有一个特征,因此公式变为

假设

\(h_{\theta}(x)=\theta_{0}+\theta_{1} x_{1}+\theta_{2} x_{2}+\cdots+\theta_{n} x_{n}\)

参数:未知

\(\theta_{0}, \theta_{1}, \ldots, \theta_{n}\)

损失函数

\(J\left(\theta_{0}, \theta_{1}, \ldots, \theta_{n}\right)=\frac{1}{2 m} \sum_{i=1}^{m}\left(h_{\theta}\left(x^{(i)}\right)-y^{(i)}\right)^{2}\)

梯度下降算法

Gradient descent:
Repeat { \(\rightarrow \theta_{j}:=\theta_{j}-\alpha \frac{\partial}{\partial \theta_{j}} J\left(\theta_{0}, \ldots, \theta_{n}\right)\)
(simultaneously update for every \(j=0, \ldots, n\) )

一般来讲梯度下降算法是适用于大样本的,大样本多大呢?10000+吧
以上线性回归的预测是连续值的情况下

适用场景

房价
人口等预测

当然了具体的建模具体分析

补充代码:

猜你喜欢

转载自www.cnblogs.com/gaowenxingxing/p/12232396.html
今日推荐