Skip to content

Commit 2f9e6fd

Browse files
authored
Merge pull request #164 from chenyyx/master
修改第8章回归文章,添加代码链接,第9章,树回归
2 parents 01dd58d + 415631f commit 2f9e6fd

7 files changed

Lines changed: 441 additions & 96 deletions

File tree

docs/8.预测数值型数据:回归.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
![预测数值型数据回归首页](../images/8.Regression/预测数值型数据回归首页.png "回归Regression首页")
55

6-
## 回归(Regressiovn) 概述
6+
## 回归(Regression) 概述
77

88
`我们前边提到的分类的目标变量是标称型数据,而回归则是对连续型的数据做出处理,回归的目的是预测数值型数据的目标值。`
99

@@ -169,6 +169,7 @@ def regression1():
169169
ax.plot(xCopy[:, 1], yHat)
170170
plt.show()
171171
```
172+
[完整代码地址](https://github.com/apachecn/MachineLearning/blob/master/src/python/8.PredictiveNumericalDataRegression/regression.py): <https://github.com/apachecn/MachineLearning/blob/master/src/python/8.PredictiveNumericalDataRegression/regression.py>
172173

173174
##### 1.5.3、线性回归 拟合效果
174175

@@ -328,6 +329,7 @@ def regression2():
328329
ax.scatter(xMat[:,1].flatten().A[0], mat(yArr).T.flatten().A[0] , s=2, c='red')
329330
plt.show()
330331
```
332+
[完整代码地址](https://github.com/apachecn/MachineLearning/blob/master/src/python/8.PredictiveNumericalDataRegression/regression.py): <https://github.com/apachecn/MachineLearning/blob/master/src/python/8.PredictiveNumericalDataRegression/regression.py>
331333

332334
##### 2.2.3、局部加权线性回归 拟合效果
333335

@@ -416,6 +418,7 @@ def abaloneTest():
416418
standyHat = mat(abX[100:199]) * standWs
417419
print "standRegress error Size is:", rssError(abY[100:199], standyHat.T.A)
418420
```
421+
[完整代码地址](https://github.com/apachecn/MachineLearning/blob/master/src/python/8.PredictiveNumericalDataRegression/regression.py): <https://github.com/apachecn/MachineLearning/blob/master/src/python/8.PredictiveNumericalDataRegression/regression.py>
419422

420423
根据我们上边的测试,可以看出:
421424

@@ -519,6 +522,7 @@ def regression3():
519522
ax.plot(ridgeWeights)
520523
plt.show()
521524
```
525+
[完整代码地址](https://github.com/apachecn/MachineLearning/blob/master/src/python/8.PredictiveNumericalDataRegression/regression.py): <https://github.com/apachecn/MachineLearning/blob/master/src/python/8.PredictiveNumericalDataRegression/regression.py>
522526

523527
##### 4.1.2、岭回归在鲍鱼数据集上的运行效果
524528

@@ -599,6 +603,7 @@ def regression4():
599603
weights = standRegres(xMat, yMat.T)
600604
print (weights.T)
601605
```
606+
[完整代码地址](https://github.com/apachecn/MachineLearning/blob/master/src/python/8.PredictiveNumericalDataRegression/regression.py): <https://github.com/apachecn/MachineLearning/blob/master/src/python/8.PredictiveNumericalDataRegression/regression.py>
602607

603608
##### 4.3.2、逐步线性回归在鲍鱼数据集上的运行效果
604609

@@ -772,6 +777,8 @@ def regression5():
772777

773778
> 使用算法:这次练习的目标就是生成数据模型
774779
780+
[完整代码地址](https://github.com/apachecn/MachineLearning/blob/master/src/python/8.PredictiveNumericalDataRegression/regression.py): <https://github.com/apachecn/MachineLearning/blob/master/src/python/8.PredictiveNumericalDataRegression/regression.py>
781+
775782
### 6、附加 权衡偏差和方差
776783

777784
任何时候,一旦发现模型和测量值之间存在差异,就说出现了误差。当考虑模型中的 “噪声” 或者说误差时,必须考虑其来源。你可能会对复杂的过程进行简化,这将导致在模型和测量值之间出现 “噪声” 或误差,若无法理解数据的真实生成过程,也会导致差异的产生。另外,测量过程本身也可能产生 “噪声” 或者问题。下面我们举一个例子,我们使用 `线性回归``局部加权线性回归` 处理过一个从文件导入的二维数据。

docs/9.树回归.md

Lines changed: 433 additions & 95 deletions
Large diffs are not rendered by default.
32 KB
Loading
20.7 KB
Loading
23.4 KB
Loading
18.1 KB
Loading
29.8 KB
Loading

0 commit comments

Comments
 (0)