├── _posts ├── database │ └── mysql.md ├── machine_learning │ ├── 2019-03-03-titanic.md │ ├── 2019-10-01-linear-regression.md │ ├── 2019-10-03-classification.md │ ├── 2019-10-02-logistics-regression.md │ ├── 2019-09-11-cat-in-the-dat.md │ ├── 2019-03-20-cnns.md │ ├── 2019-03-10-RNN.md │ ├── 2019-03-04-train-dl.md │ ├── 2019-09-30-what-is-machine-learning.md │ └── 2019-10-04-pca.md ├── python │ ├── 2018-11-02-pandas.html │ ├── 2019-09-21-sparse-matrix.md │ ├── 2018-10-06-python-snippets.md │ ├── 2018-07-04-format.md │ └── 2018-06-02-python-re.md ├── rec │ ├── 2019-09-10-ncf-code.md │ ├── 2019-09-12-fm-family-code.md │ ├── 2019-08-31-amazon-item-to-item.md │ ├── 2019-09-06-deep-FM.md │ ├── 2019-09-04-wide-deep.md │ ├── 2019-09-05-FM.md │ ├── 2019-09-17-item-sim-models.md │ ├── 2019-09-10-ncf.md │ └── 2019-09-24-crt-models.md ├── network │ ├── 2015-08-31-http-headers.md │ ├── 2016-08-25-arp.md │ ├── log.md │ ├── 2015-08-31-http-semantic.md │ ├── 2015-09-01-http-cache.md │ ├── 2020-02-20-https.md │ ├── 2020-07-23-计算机网络.md │ ├── 2015-09-03-http-cookit.md │ └── 2020-06-10-http-body-encoding.md ├── unix │ ├── time.md │ ├── open.md │ ├── 2020-01-10-dynamic-memory.md │ ├── 2019-12-18-client-server-pattern.md │ └── signal.md ├── cs │ ├── 2016-05-19-use-summator-do-subtraction.md │ ├── 2020-06-02-codec.md │ ├── 2015-05-01-computer-storage-systemter.md │ └── 2015-02-10-data-representation.md ├── algorithm │ ├── 2015-03-01-pow-no-recurtion.md │ ├── 2017-06-09-newtons-method.md │ ├── 2017-01-05-sort.md │ ├── 2018-01-10-maximum-contiguous-subsequence.md │ ├── 2019-08-11-binary-search.md │ ├── 2019-10-13-sample.md │ └── 2017-04-10-link-list.md ├── cpp │ ├── 2015-04-29-cpp-inherit-type.md │ ├── 2020-02-08-c-vararg.md │ ├── 2015-11-03-effective-cpp-46.md │ ├── 2015-03-15-c-pre-processing.md │ └── 2020-05-20-chrono.md ├── web │ ├── 2016-11-11-avoid-forced-synchonous-layout.md │ ├── 2016-11-01-how-gpu-speed-up-page-render.md │ ├── 2016-05-18-web-security.md │ ├── css │ │ ├── 2015-09-10-css-flex.md │ │ ├── 2015-08-20-css-selector.md │ │ └── 2015-10-10-css-animation.md │ ├── 2016-09-08-css-center.md │ ├── 2016-07-21-fetch-API.md │ └── 2016-04-02-high-performace-web.md └── tools │ └── 2018-11-30-jupyterlab.md ├── README.md ├── site ├── assets │ ├── images │ │ ├── favicon.ico │ │ └── loading.gif │ ├── css │ │ ├── text.scss │ │ ├── style.scss │ │ └── scss │ │ │ ├── m-enhance.scss │ │ │ ├── print.scss │ │ │ ├── var.scss │ │ │ ├── m-tools.scss │ │ │ ├── m-site.scss │ │ │ ├── m-footer.scss │ │ │ ├── m-home.scss │ │ │ ├── m-header.scss │ │ │ ├── m-list.scss │ │ │ ├── notebook.scss │ │ │ ├── common.scss │ │ │ ├── highlight.scss │ │ │ ├── m-post.scss │ │ │ └── m-icon.scss │ └── js │ │ └── lib │ │ └── ansi_up.min.js ├── pages │ ├── 404.md │ ├── about.md │ ├── list.html │ ├── tags.html │ ├── categories.html │ └── index.html ├── _layouts │ ├── page.html │ ├── notebook.html │ ├── post.html │ ├── blank.html │ └── default.html └── _includes │ ├── tongji.js │ ├── init.html │ ├── footer.html │ └── echo.js └── _config.yml /_posts/database/mysql.md: -------------------------------------------------------------------------------- 1 | lqcG,H-w1_d; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Notebook 2 | 3 | 我的编程笔记本,记录平时所学编程相关的知识,便于随时查阅。 4 | -------------------------------------------------------------------------------- /site/assets/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/w4096/notebook/HEAD/site/assets/images/favicon.ico -------------------------------------------------------------------------------- /site/assets/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/w4096/notebook/HEAD/site/assets/images/loading.gif -------------------------------------------------------------------------------- /site/pages/404.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: 出错啦! 4 | permalink: /404.html 5 | --- 6 | 7 | 此页面还没开发出来,看看别的页面吧先... :) 8 | -------------------------------------------------------------------------------- /site/assets/css/text.scss: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | @charset "utf-8"; 5 | 6 | @import 'var'; 7 | @import 'typo'; 8 | @import "m-site"; 9 | @import "print"; -------------------------------------------------------------------------------- /_posts/machine_learning/2019-03-03-titanic.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: notebook 3 | title: Kaggle - 泰坦尼克号 4 | category: 机器学习 5 | file: "notebook/titanic.ipynb" 6 | --- -------------------------------------------------------------------------------- /_posts/python/2018-11-02-pandas.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: notebook 3 | title: Pandas 操作指南 4 | category: Python 5 | tags: ['编程'] 6 | file: notebook/pandas.ipynb 7 | --- -------------------------------------------------------------------------------- /_posts/python/2019-09-21-sparse-matrix.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: notebook 3 | title: 稀疏矩阵 - COO, CSR, CSC 4 | category: Python 5 | file: notebook/sparse-matrix.ipynb 6 | --- -------------------------------------------------------------------------------- /_posts/machine_learning/2019-10-01-linear-regression.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: notebook 3 | title: 机器学习 - 线性回归 4 | category: 机器学习 5 | file: notebook/002-linear-regression.ipynb 6 | --- -------------------------------------------------------------------------------- /_posts/machine_learning/2019-10-03-classification.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: notebook 3 | title: 机器学习 - 分类问题 4 | category: 机器学习 5 | file: notebook/004-classification.ipynb 6 | --- 7 | -------------------------------------------------------------------------------- /_posts/rec/2019-09-10-ncf-code.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: notebook 3 | title: Neural Collaborative Filtering 实现 4 | category: 推荐系统 5 | tags: ['推荐系统'] 6 | file: notebook/NCF.ipynb 7 | --- -------------------------------------------------------------------------------- /_posts/rec/2019-09-12-fm-family-code.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: notebook 3 | title: FM, FFM, DFM, NFM, Wide & Deep 实现 4 | category: 推荐系统 5 | tags: ['推荐系统'] 6 | file: notebook/FM.ipynb 7 | --- -------------------------------------------------------------------------------- /_posts/machine_learning/2019-10-02-logistics-regression.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: notebook 3 | title: 机器学习 - 逻辑回归 4 | category: 机器学习 5 | file: "notebook/003-logistics-regression.ipynb" 6 | --- -------------------------------------------------------------------------------- /_posts/python/2018-10-06-python-snippets.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: notebook 3 | title: Python 代码片段 4 | category: Python 5 | tags: ['Python','编程'] 6 | file: notebook/python_snippets.ipynb 7 | --- -------------------------------------------------------------------------------- /_posts/machine_learning/2019-09-11-cat-in-the-dat.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: notebook 3 | title: Kaggle - Categorical Feature Encoding Challenge 4 | category: 机器学习 5 | file: "notebook/cat-in-the-dat.ipynb" 6 | --- -------------------------------------------------------------------------------- /site/_layouts/page.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 | 5 |
{{ post.title }}
{{ post.date|date:"%Y/%m/%d" }} 16 | 17 |{{ post.title }}
{{ post.date|date:"%Y/%m/%d" }} 27 | 28 |{{ post.title }}
{{ post.date|date:"%Y/%m/%d" }} 27 | 28 |10 | 我的编程笔记,记录平时学到的编程知识,便于自己随时查阅。 11 |
12 | 13 | 20 | 21 | 22 |{{ post.title }}
{{ post.date|date:"%Y/%m/%d" }} 29 | 30 |{{ post.title }}
{{ post.date|date:"%Y/%m/%d" }} 46 | 47 |{{ site.slogan }}
29 |
74 |
75 | 梯度消失的原因主要是使用 sigmoid 作为激活函数导致的,sigmoid 函数当输入很大或很小时,其梯度都接近于 0。
76 |
77 | Relu 激活函数的问题在于,一旦某个 unit 输出小于 0,那么它之后就只会输出 0,而且梯度也会是 0,即 ReLU 也可能出现梯度消失的问题,此 unit 的权重将得不到更新。这个问题称为 Dead ReLUs。
78 |
79 | 梯度爆炸常常出现在循环神经网络中。_为啥_
80 |
81 | ## Batch Normalization
82 |
83 | 使用 ReLU 及其变种,加上合适的参数初始化策略,在训练的初期可以很好地消除梯度消失/爆炸的问题,但不能保证在整个训练过程中都不出现梯度消失/爆炸的问题。Batch Normalization 对输入的整个 batch 的数据做标准化,可以持续减缓梯度消失/爆炸的问题。
84 |
85 | Batch Normalization 需要调整的参数不多,`momentum` 用于计算动态调整的均值,它的值应该接近于 1。样本集越大,或者 batch-size 越小时,`momentum` 应该越接近于 1。
86 |
87 | 如果在输入层之后紧接一个 batch normalization 层,对数据做标准化操作就可以不用显式地完成了。
88 |
89 | ## 梯度裁剪
90 |
91 | 梯度裁剪是限制梯度的大小不超过某个阈值。在 RNN 中梯度裁剪尤其重要,因为 RNN 常常出现梯度爆炸的问题。
92 |
93 | ```python
94 | optimizer = keras.optimizers.SGD(clipvalue=1.0)
95 | model.compile(loss="mse", optimizer=optimizer)
96 | ```
97 |
98 | 在 keras 中设置梯度裁剪尤其简单,以上代码将限制梯度的绝对值小于 1.0。对梯度的某个分量进行裁剪,会导致梯度方向的改变,比如原梯度为 `[100, 1]`, 裁剪后变为 `[1, 1]`,这极大地改变了梯度方向。要想保证梯度方向不变,可以对梯度的 L2 范数做限制,即限制梯度向量的模长。下面的设置保证梯度的模长不大于 1,否则各个分量都进行缩减,保证梯度方向不变。
99 |
100 | ```python
101 | optimizer = keras.optimizers.SGD(clipnorm=1.0)
102 | ```
--------------------------------------------------------------------------------
/_posts/web/2016-09-08-css-center.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: post
3 | title: CSS 垂直居中
4 | category: Web
5 | ---
6 |
7 |
8 |
9 | - *
10 | {:toc}
11 |
12 |
24 |
25 |
26 | 垂直居中,这是任何前端开发者都遇到的场景,也是大多数人都为之困惑的问题。记得当时来公司后,进行了一次笔试,其中一个便是用 CSS 实现垂直居中,我突然发现自己竟不能写出一种自信无误的实现方式。
27 |
28 | 下面来总结一下 CSS 垂直居中的方式,对于 hack 气息较重的方法(比如使用 table,button 等)这里不再讨论了,这里主要谈谈现代 CSS 中实现垂直居中的方式。
29 |
30 |
31 | 下面的示例中均采用下面这样的 HTML 结构:
32 |
33 | ```html
34 |
75 | */
76 | img[src*=selector]
77 |
78 |
79 | /*
80 | 选择 class 属性中包含字符串单词 selector 的 img 标签,与前一个不同的是,这里要求是单词,前一个匹配的是子字符串
81 |
82 |
99 | */
100 | img[src$=jpg]
101 | ```
102 |
103 |
104 | 注意:乍一看好像 `img[src^=http]` 和 `img[src|=http]` 是一样的,其实不然。前者匹配前缀字符串,后缀匹配第一个单词。举个不恰当的例子:
105 |
106 | ```html
107 | part 1
148 | ``` 149 | 150 | 当点击了标签之后,url 中的锚点就变成了 part-1 这就和 p 标签的 id 匹配了。此时该 p 标签被匹配。 151 | 152 | ### 语言伪类选择器 153 | 154 | 语言伪类选择器是通过标签的 lang 属性来进行匹配的 155 | 156 | ```css 157 | E:lang(language){} 158 | ``` 159 | 160 | 可以使用该属性来匹配不同语言的元素 161 | 162 | ### UI状态伪类选择器 163 | 164 | + `E:checked` 165 | + `E:enabled` 166 | + `E:disabled` 167 | + `E:focus` 168 | 169 | 这几个属性通常用在 `` 和 `