这是我参与8月更文挑战的第8天,活动详情查看:8月更文挑战
univariate linear regression
预测房屋价格
首先继续说房价预测这个问题。
回忆一下,房价问题属于监督学习的回归问题。
已知数据有房屋面积以及对应的价格。
经过算法处理,这些数据更适合拟合成一条一元函数的直线。得出结果如下:
由上图可以预测,如果有一套房子的面积为1250feet²,那预测其价格应该在$220 000左右。
一些概念
In supervised learning, we have a data set and this data set is called a training set.
在监督学习中我们有一个数据集被称为训练集。
Notation:
- =Number of training examples 训练样本的数量
- ="input"variable/features 输入变量
- ="output"variable/"target"variable 输出变量,即预测的结果
- =one training example 一个训练样本
- =ith training example 第i个训练样本
- Hypothesis:. 拟合出的假设函数,有时简写为
就上边房价的例子中,下边给出一个具体数据。
预测房价训练集:左侧一列数据是房屋面积,右侧一列数据是房屋价格。
- 房屋面积及其对应的价格组成的数据集就是训练集。
- 假如训练集中房屋面积及其价格数据对一共有41对,那这个训练集中。
- 由于是一元线性回归,因此假设函数是
- ……
再给出一些概念
How supervised learning algorithm works:
监督学习流程:
We saw that with the training set like our training set of housing prices and we feed that to our learning algorithm.
首先我们给学习算法提供训练集,比如给房价训练集。
Is the job of a learning algorithm to then output a function, which by convention is usually denoted lowercase h, and h stands for hypothesis.
学习算法输出一个函数,用常用小写h表示。h即假设函数。
And what the job of the hypothesis is a function that takes as input the size of a house. And it tries to output the estimated value ofy for the corresponding house. So h is a function that maps from x's to y's.
假设函数就是把房屋大小作为输入,并输出预测的房屋价格。因此假设函数就是引导x得到y的函数。
In univariate linear regression, the hypothesis is . These theta i's are what I called the paraneters of the model.
单变量线性回归中假设函数为,其中为模型参数
How to choose these two parameter values, theta zero and theta one. With different choices of parameters theta zero and theta one we get different hypotheses, different hypothesis functions.
选择不同的会产生不同的假设函数。