machine learning 基本概念二
接上
linear models are too simple…we need more sophisticated models.
Model Bias:来自model的限制,模型偏差
一、function with unknown
1.线性——>红色折线如何表示
![2H0D(D:\QQ2020\2310518260\FileRecv\MobileFile\Image\2H0D(PK0C8$@EXMT%)FDG4P.png)FDG4P](https://i-blog.csdnimg.cn/blog_migrate/0993eed4672a917adc01ba7d61dc2c1a.png)
all piecewise linear curves(分段线性曲线) =constant +sum of a set of blue curve. More pieces require more blue curves.
![image-20211121165813528](https://i-blog.csdnimg.cn/blog_migrate/48c1ad59e2b90184ab7eb1193ab7e9dd.png)
2.Beyond Piecewise Linear曲线如何表示
如果是Beyond Piecewise Linear,也可以由许多piecewise linear curves组成。approximate continuous curve by a piecewise linear curve. To have good approximation, we need sufficient pieces.
![image-20211121170252082](https://i-blog.csdnimg.cn/blog_migrate/c78cde3eb0baf84fbc6db747b38320e5.png)
3.blue curve——sigmoid function
How to represent the blue function?
![image-20211121171438318](https://i-blog.csdnimg.cn/blog_migrate/6c57437524025ed40f567f45857ead65.png)
调整参数c b w来制造不同的sigmoid function
![image-20211121171740878](https://i-blog.csdnimg.cn/blog_migrate/3eef4f6768356fff11f0280ce48d8577.png)
3.1sigmoid函数形式化推导
下面推导最开始的red curve该怎么用sigmoid函数表示?
![image-20211121172943173](https://i-blog.csdnimg.cn/blog_migrate/b9fd3b3a1bec2b014351b2ac2866cd60.png)
其中j表示的是有多少个feature;i表示是有多少个blue curve也就是sigmoid function。w12表示第二个feature对于第一个sigmoid函数的权重。r1、r2、r3和三个参数的关系如下所示。
![image-20211121173351220](https://i-blog.csdnimg.cn/blog_migrate/5d1397f0539a733b3ed52f6a09101b23.png)
接下来r1、r2、r3分作sigmoid。
![image-20211121173829414](https://i-blog.csdnimg.cn/blog_migrate/d926e5803712642f5592528b80e97740.png)
未知参数的定义,将上述函数的所有未知数全部组合成一列得到,所有未知数的一列。
![image-20211121174039680](https://i-blog.csdnimg.cn/blog_migrate/16a57cae9dfb1109a842111116d8644b.png)
3.2问题记录
1.参数很多,不能使用暴力搜索的方法
- sigmoid数量是自己定义的,数量越多,函数越复杂。
- hard sigmoid可以使用别的函数近似替代,本身的hard也可以,只是比较复杂。
二、define loss from training data
Loss is a function of parameters L(θ)
Loss means how good a set of values is.
![image-20211121175306254](https://i-blog.csdnimg.cn/blog_migrate/91c7060815e42ea3018fd75a7bf6ba34.png)
三、optimization
![image-20211121180236956](https://i-blog.csdnimg.cn/blog_migrate/7485923babd3af28152041079ce4208a.png)
实际上在做梯度变化时, 不是拿所有的数据进行计算gradient的,而是第一个batch用来计算θ1,第二个batch用来计算θ2。其中batch的大小是由认为选定的。
![image-20211121181515444](https://i-blog.csdnimg.cn/blog_migrate/475cd3b08ab8ea674f8cd793703ab547.png)
下面有两个例子来说明update和epoch的区别
![image-20211121181839960](https://i-blog.csdnimg.cn/blog_migrate/cd8a8266c9791a8eaf148f1505a9d68a.png)
至此,我们知道在机器学习中有三个hyperparameters(认为规定的参数)—— 学习率 sigmoid batch的大小
四、模型变形
变换激活函数
![image-20211121182607305](https://i-blog.csdnimg.cn/blog_migrate/2228ffc2c5711c0398f4240f5bc4f788.png)
![image-20211121182817374](https://i-blog.csdnimg.cn/blog_migrate/d2d261e7d617abad2209eb1b1b6eb6ee.png)
![image-20211121182936446](https://i-blog.csdnimg.cn/blog_migrate/cd122bcaffc5553a5de21dea51e9adab.png)
100个ReLU可以制造非常复杂的曲线了,因此Loss会显著减少。
增加层
![image-20211121183311949](https://i-blog.csdnimg.cn/blog_migrate/2e46eed658fb8c590474ad8c08934b7e.png)
实验数据,使用三层隐藏层效果显著。
![image-20211121183444227](https://i-blog.csdnimg.cn/blog_migrate/a1ae02b9ee3ce5a92d20dcffc3361f24.png)
![image-20211121183733493](https://i-blog.csdnimg.cn/blog_migrate/8f23273624a1cfeed681d3fc29844976.png)
It needs a fancy name——Neural Network神经网络——many layer means deep——Deep Learning
733493" style=“zoom: 50%;” />
It needs a fancy name——Neural Network神经网络——many layer means deep——Deep Learning
![image-20211121184222366](https://i-blog.csdnimg.cn/blog_migrate/9edeacd38b4984ac9c02ab799cc1ff72.png)
one two 3 未完待续…