-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatom.xml
More file actions
157 lines (99 loc) · 19.1 KB
/
atom.xml
File metadata and controls
157 lines (99 loc) · 19.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Charles's Freetalk</title>
<link href="/atom.xml" rel="self"/>
<link href="http://yoursite.com/"/>
<updated>2019-04-02T06:09:28.351Z</updated>
<id>http://yoursite.com/</id>
<author>
<name>JazzCharles</name>
</author>
<generator uri="http://hexo.io/">Hexo</generator>
<entry>
<title>Statistical Learning Chapter 2 --- Perceptron</title>
<link href="http://yoursite.com/2019/04/02/SL-Chapter2/"/>
<id>http://yoursite.com/2019/04/02/SL-Chapter2/</id>
<published>2019-04-02T05:44:10.000Z</published>
<updated>2019-04-02T06:09:28.351Z</updated>
<content type="html"><![CDATA[<p>In Chapter 2, we introduce a linear binary classifier — Perceptron. It takes linearly separable samples as input and output +1/-1 to represent positive and negative. I’ll summarize Perceptron in the following ways.</p><ul><li>Concept</li><li>Model </li><li>Loss Function</li><li>Optimization Algorithm and the Dual Form</li><li>Convergence</li></ul><a id="more"></a><p>Please refer to the notes:<br><a href="https://github.com/Jazzcharles/Notes-on-Statiscal-Learning/blob/master/Chapter2_Perceptron.pdf" target="_blank" rel="noopener">https://github.com/Jazzcharles/Notes-on-Statiscal-Learning/blob/master/Chapter2_Perceptron.pdf</a></p>]]></content>
<summary type="html">
<p>In Chapter 2, we introduce a linear binary classifier — Perceptron. It takes linearly separable samples as input and output +1/-1 to represent positive and negative. I’ll summarize Perceptron in the following ways.</p>
<ul>
<li>Concept</li>
<li>Model </li>
<li>Loss Function</li>
<li>Optimization Algorithm and the Dual Form</li>
<li>Convergence</li>
</ul>
</summary>
<category term="Statistical Learning" scheme="http://yoursite.com/tags/Statistical-Learning/"/>
</entry>
<entry>
<title>Network in Network [ICLR 2013]</title>
<link href="http://yoursite.com/2019/02/15/Network-in-Network/"/>
<id>http://yoursite.com/2019/02/15/Network-in-Network/</id>
<published>2019-02-14T16:00:00.000Z</published>
<updated>2019-02-26T13:59:07.586Z</updated>
<content type="html"><![CDATA[<p>安利一篇发表在13年ICLR的经典著作——《Network in Network》,其中提到的几个经典结构被后来所广泛应用。<br><a href="https://arxiv.org/pdf/1312.4400.pdf" target="_blank" rel="noopener">https://arxiv.org/pdf/1312.4400.pdf</a></p><h4 id="Spotlight"><a href="#Spotlight" class="headerlink" title="Spotlight"></a>Spotlight</h4><ul><li>小网络嵌入大网络的思想</li><li>1 * 1 卷积</li><li>全局平均池化(Global Average Pooling)</li><li>在当时的Cifar-10,Cifar-100上取得了SOTA</li></ul><a id="more"></a><h4 id="Drawbacks"><a href="#Drawbacks" class="headerlink" title="Drawbacks"></a>Drawbacks</h4><ol><li>传统的神经网络都是通过线性滤波器接非线性激活函数构成,而线性滤波器的特征提取能力有限。必须假设数据是线性可分的,而很多时候数据往往是一个非线性流型。</li><li>传统的网络最后的全链接层(Fully Connected Layer)很容易导致过拟合且对于类别区分的可解释性不强。</li></ol><h4 id="Solutions"><a href="#Solutions" class="headerlink" title="Solutions"></a>Solutions</h4><ol><li>问题一的解决方法非常直观——既然线性核的能力有限,没错那增加核的数量就可以了啊,因此我们会经常见到上百维通道数的卷积核!那无止境加下去网络的负担就太重了,于是体现Contribution的时候到了!<br>我们现在可以知道深度网络在足够深的情况下能够近似的拟合任何函数,那何不利用这样一个网络(例如多层感知机MLP)去替代卷积核呢?(马后炮一下,13年能有这种idea实属厉害!)在保证能够端到端利用反向传播更新的同时增强了判别能力。文中将这样替换的层称作——mlpconv。原来是利用卷积核在输入特征图上进行滑动,现在改为利用一个MLP进行滑动,同样作用于局部的特征提取。<br><img src="https://github.com/Jazzcharles/Jazzcharles.github.io/raw/master/images/NIN_Fig1.png" alt="Icon"><br>值得一提的是,在实现的过程中采用了1×1卷积来构建MLP。也是1×1卷积首次被提出!</li><li>由于全连接层扮演着类似黑盒操作的来通过将特征图拉伸为特征向量再整合成更低(高)维的特征向量,不具有很高的可解释性,作者提出了直接将特征图和类别之间建立起关联——通过全局平均池化,即对每一通道的特征图独立地进行池化操作,得到的值作为类别的置信度。文中表明全局平均池化本身也可以作为结构化正则项来对抗过拟合。全局平均池化有两个显著优点:<br> (1) 不需要额外的参数,而通常CNN的网络参数大多集中在全连接层,减轻了网络的复杂性。<br> (2) 由于对整张特征图采取平均操作,因此对于图像中微小的扰动,空间上的变换具有更强的鲁棒性。<blockquote><p>例如经过数个卷积层之后总共有c个,大小都为 n $$\times$$ n 的特征图,对每一个特征图的 n $$\times$$ n 个值取平均得到一个值,体现了全局的概念。输出维度为[c, 1]的特征向量。再通过如Softmax层等对应到各类别概率。</p></blockquote><h4 id="Structure"><a href="#Structure" class="headerlink" title="Structure"></a>Structure</h4></li></ol><ul><li>整个网络的架构如下图所示,总共采用了三个Mlpconv层接最大池化,并在除了最后Mlpconv层以外的输出加入Dropout<br><img src="https://github.com/Jazzcharles/Jazzcharles.github.io/raw/master/images/NIN_Fig2.png" alt="Icon"><h4 id="Results"><a href="#Results" class="headerlink" title="Results"></a>Results</h4></li><li>方便起见只贴一个在Cifar-10上SOTA的结果,主要的对比对象是同年ICML上又一篇佳作《Maxout Network》[2]有空再讲。<br><img src="https://github.com/Jazzcharles/Jazzcharles.github.io/raw/master/images/NIN_Fig3.png" alt="Icon"><h4 id="References"><a href="#References" class="headerlink" title="References"></a>References</h4></li><li>Min Lin, Qiang Chen, and Shuicheng Yan. Network in network. CoRR abs/1312.4400, 2013</li><li>Goodfellow, Ian J., et al. “Maxout networks.” arXiv preprint arXiv:1302.4389 (2013).</li></ul>]]></content>
<summary type="html">
<p>安利一篇发表在13年ICLR的经典著作——《Network in Network》,其中提到的几个经典结构被后来所广泛应用。<br><a href="https://arxiv.org/pdf/1312.4400.pdf" target="_blank" rel="noopener">https://arxiv.org/pdf/1312.4400.pdf</a></p>
<h4 id="Spotlight"><a href="#Spotlight" class="headerlink" title="Spotlight"></a>Spotlight</h4><ul>
<li>小网络嵌入大网络的思想</li>
<li>1 * 1 卷积</li>
<li>全局平均池化(Global Average Pooling)</li>
<li>在当时的Cifar-10,Cifar-100上取得了SOTA</li>
</ul>
</summary>
<category term="classification" scheme="http://yoursite.com/tags/classification/"/>
</entry>
<entry>
<title>Python——装饰器</title>
<link href="http://yoursite.com/2018/07/18/Python%E2%80%94%E2%80%94%E8%A3%85%E9%A5%B0%E5%99%A8/"/>
<id>http://yoursite.com/2018/07/18/Python——装饰器/</id>
<published>2018-07-18T01:50:47.000Z</published>
<updated>2019-02-15T01:57:53.931Z</updated>
<content type="html"><![CDATA[<p>前段时间头条面试的时候被问了一个问题——如何高效的测定程序中每个模块的运行时间,并且不用对代码进行很多修改。没答出来…<br>答案是装饰器,装饰器decorator顾名思义就是在利用函数为对象的性质在函数外套一个函数外壳以实现一些基础操作,通过在被装饰函数上方添加@decorator_func_name实现,例如打印日志、测试运行时间等。</p><a id="more"></a><h5 id="1-装饰器蓝本规范"><a href="#1-装饰器蓝本规范" class="headerlink" title="1. 装饰器蓝本规范"></a>1. 装饰器蓝本规范</h5><pre><code>from functools import wrapsdef decorator_name(f): @wraps(f) def decorated(*args, **kwargs): if not can_run: return "Function will not run" return f(*args, **kwargs) return decorated@decorator_namedef func(): return("Function is running")can_run = Trueprint(func())can_run = Falseprint(func())</code></pre><h5 id="2-打印日志"><a href="#2-打印日志" class="headerlink" title="2. 打印日志"></a>2. 打印日志</h5><pre><code>def logger(func): def print_log(*args, **kwargs): print('Params are %s, %s' % (args,kwargs)) ret = func(*args, **kwargs) return ret return print_log@loggerdef get_sum(a, b): print(a, b) return a + bget_sum(a = 1, b = 2)</code></pre><h5 id="3-运行时间"><a href="#3-运行时间" class="headerlink" title="3. 运行时间"></a>3. 运行时间</h5><pre><code>import timedef timer(func): def time_func(*args, **kwargs): start_time = time.time() print('Begin time ', start_time) ret = func(*args, **kwargs) end_time = time.time() print('End time ', end_time) print('time ', end_time - start_time) return ret return time_func@timerdef get_sum(a, b): print('a + b = ', a + b) return a + bget_sum(1, 2)</code></pre><p>Ref:<a href="https://eastlakeside.gitbooks.io/interpy-zh/content/decorators/your_first_decorator.html" target="_blank" rel="noopener">https://eastlakeside.gitbooks.io/interpy-zh/content/decorators/your_first_decorator.html</a></p>]]></content>
<summary type="html">
<p>前段时间头条面试的时候被问了一个问题——如何高效的测定程序中每个模块的运行时间,并且不用对代码进行很多修改。没答出来…<br>答案是装饰器,装饰器decorator顾名思义就是在利用函数为对象的性质在函数外套一个函数外壳以实现一些基础操作,通过在被装饰函数上方添加@decorator_func_name实现,例如打印日志、测试运行时间等。</p>
</summary>
<category term="Python" scheme="http://yoursite.com/tags/Python/"/>
</entry>
<entry>
<title>Pytorch入门——Linear Regression</title>
<link href="http://yoursite.com/2018/07/14/Pytorch%E5%85%A5%E9%97%A8%E2%80%94%E2%80%94Linear-Regression/"/>
<id>http://yoursite.com/2018/07/14/Pytorch入门——Linear-Regression/</id>
<published>2018-07-14T13:21:05.000Z</published>
<updated>2019-02-15T01:57:53.931Z</updated>
<content type="html"><![CDATA[<p>感觉身边用torch的人还是很多的,趁机会蹭蹭热度~<br>以下是用torch实现线性回归的例子学习 y = k <em> x + b 中的 k 和 b<br>loss = (1/2) </em> sigma((y[i] - (k * x[i] + b)) ^ 2), 通过链式手动求梯度更新参数,更一般地利用autograd自动求导</p><a id="more"></a><pre><code>import torch as timport matplotlib as mpbfrom matplotlib import pyplot as pltimport numpy as npfrom IPython import displayprint('Done Import')t.manual_seed(1000)# generate data per batch# k = 2, b = 3.5def get_data_batch(batch_size = 8): x = t.rand(batch_size, 1) * 20 y = 2 * x + 3 * (1 + t.rand(batch_size, 1)) # y = 2x + 3 + noise return x, y# Initialize w, bw = t.rand(1, 1)b = t.zeros(1, 1)learning_rate = 0.001num_epochs = 10000loss_history = []batch_size = 8for i in range(num_epochs): x_train, y_train = get_data_batch(batch_size) # y_pred = t.matmul(w, x_train) + b y_pred = x_train.mm(w) + b.expand_as(y_train) loss = 0.5 * (y_train - y_pred) ** 2 loss = loss.sum() dloss = 1 dloss = dloss * (y_train - y_pred) * (-1) # dw = x_train.t().mm(dloss) dw = t.matmul(dloss.t(), x_train) # accumulate the gradient of db # print(dw.size()) db = dy_pred.sum() w.sub_(learning_rate * dw) b.sub_(learning_rate * db) loss_history.append((w, b)) if i % 1000 == 0: #print(i, ' w = ', w, ' loss = ', loss) display.clear_output(wait = True) x = t.arange(0, 20).view(-1, 1) y = x.mm(w) + b.expand_as(x) #print(x, y) plt.plot(x.numpy(), y.numpy()) x2, y2 = get_data_batch(20) plt.scatter(x2.numpy(), y2.numpy()) plt.xlim(0, 20) plt.ylim(0, 41) plt.show() plt.pause(0.5)print("w = ", w, " b = ", b)</code></pre><p>参考资料:《深度学习框架Pytorch入门与实践》</p>]]></content>
<summary type="html">
<p>感觉身边用torch的人还是很多的,趁机会蹭蹭热度~<br>以下是用torch实现线性回归的例子学习 y = k <em> x + b 中的 k 和 b<br>loss = (1/2) </em> sigma((y[i] - (k * x[i] + b)) ^ 2), 通过链式手动求梯度更新参数,更一般地利用autograd自动求导</p>
</summary>
<category term="Pytorch" scheme="http://yoursite.com/tags/Pytorch/"/>
<category term="Python" scheme="http://yoursite.com/tags/Python/"/>
</entry>
<entry>
<title>阿飞正传——观后感</title>
<link href="http://yoursite.com/2018/07/02/%E9%98%BF%E9%A3%9E%E6%AD%A3%E4%BC%A0%E2%80%94%E2%80%94%E8%A7%82%E5%90%8E%E6%84%9F/"/>
<id>http://yoursite.com/2018/07/02/阿飞正传——观后感/</id>
<published>2018-07-02T08:59:48.000Z</published>
<updated>2019-02-15T01:57:53.931Z</updated>
<content type="html"><![CDATA[<p>前两天去看了《阿飞正传》,作为一个不经常看电影,更不经常看王家卫导演的电影的我,纯粹是冲着张国荣的盛世美颜去的。影片讲述了张国荣扮演的阿飞在寻找亲生母亲的过程中和刘嘉玲、张曼玉以及养母之间发生的一系列故事。</p><p>平心而论,文艺片从故事情节几乎很难打动观众,这部片子亦是如此,但是依然能够从哥哥的身上读出不少的内容。哥哥身上的两条线一同发展————爱情与亲情。</p><a id="more"></a><p><img src="https://github.com/Jazzcharles/Jazzcharles.github.io/raw/master/images/20.jpg" alt="Icon"></p><h3 id="亲情"><a href="#亲情" class="headerlink" title="亲情"></a>亲情</h3><p>寻亲一直是推动情节发展的主线,本来给人不讨喜形象的上海养母在哥哥执意离去时说的一番话很让人动容。恰巧前不久也和同学讨论过亲生父母和养父母的问题。没有哪个养父养母会比生父生母对孩子倾注更少的爱。想起当初周立波在节目中道德压迫女孩能原谅生父生母的那一幕,无论是生父母还是养父母都应该给予孩子最起码的尊重,至于对错之分往往都是次要的。我想哥哥在听完那段话之后无语凝噎也是释怀了对养母的那份情感吧。</p><h3 id="爱情"><a href="#爱情" class="headerlink" title="爱情"></a>爱情</h3><p>让人感触更深的莫过于哥哥和曼玉这一条感情线的发展。从影片的一开头两人迫于现实必须分道扬镳,整部剧似乎很大篇幅都在集中刻画曼玉和华仔、哥哥和刘嘉玲(以及学友)的两个部分。可是在我看来,哥哥只是把嘉玲当作肉体的寄托,并不能弥补他精神上的情感空虚,最明显的就是在二女会面的时候互相吃醋的场景时哥哥的那番言行。虽然哥哥和曼玉的这段情也谈不上刻骨铭心、忠贞不渝,但要知道哥哥在火车上最后还是淡然的和华仔谈论着他们心底里那个女人,也就足够了。</p><p>毕竟知音难觅,又有多少人能真正意义上最后嫁给爱情呢,又有多少人为了父母、为了社会的压力而草草妥协。反思当今社会,快餐文化在不停的荼毒着年轻人的爱情观,大学校园里,每到深夜的池边,树林下的荷尔蒙总在刺激着那些单身男女,仿佛一道无形的空气屏障压迫着你————“哦,我也多想像他们一样啊”。但是脱单之后的你拥有了一个喜欢你的人,但是是不是与此同时也失去了一个喜欢本你的自己?很多东西,是不去亲身经历所体会不到的。在这毕业季,无数的人碍于现实分了手,无数的人为将来步入社会没有途径接触另一半而无比焦虑。不知道女生是怎么想,我想至少身边的男同胞们都觉得理想更为重要,片中如果把哥哥寻亲作为他的理想,那么亦是如此,至少从生活状态来看他给不了曼玉未来,他也不会轻易做出承诺,哪怕这种冷漠可能会深深的伤害到双方……</p><p>我想我也不能免俗,又有谁不渴望执子之手与子偕老的爱情呢?与此同时我也知道,为了毕业的时候能对得起自己,家人,甚至是那个遥远的她,三年里的精力还是会更侧重于学习,强求另一半来跟着我受这些苦更想必也是不负责任吧。</p><p><img src="https://github.com/Jazzcharles/Jazzcharles.github.io/raw/master/images/21.jpg" alt="Icon"></p>]]></content>
<summary type="html">
<p>前两天去看了《阿飞正传》,作为一个不经常看电影,更不经常看王家卫导演的电影的我,纯粹是冲着张国荣的盛世美颜去的。影片讲述了张国荣扮演的阿飞在寻找亲生母亲的过程中和刘嘉玲、张曼玉以及养母之间发生的一系列故事。</p>
<p>平心而论,文艺片从故事情节几乎很难打动观众,这部片子亦是如此,但是依然能够从哥哥的身上读出不少的内容。哥哥身上的两条线一同发展————爱情与亲情。</p>
</summary>
<category term="movie" scheme="http://yoursite.com/tags/movie/"/>
</entry>
<entry>
<title>Charles's Freetalk</title>
<link href="http://yoursite.com/2018/06/29/first-demo-hello-world/"/>
<id>http://yoursite.com/2018/06/29/first-demo-hello-world/</id>
<published>2018-06-29T08:13:00.000Z</published>
<updated>2019-02-15T01:57:53.931Z</updated>
<content type="html"><![CDATA[<h1 id="Charles’s-Freetalk"><a href="#Charles’s-Freetalk" class="headerlink" title="Charles’s Freetalk"></a>Charles’s Freetalk</h1><hr><p>借着Github搭了个小的Blog, 其实也只是想找一个平台写写平时心里的想法。时间无言、如此这般,只希望未来的几年学习生活能对得起自己曾经许下的诺言吧。</p><ul><li>日常生活</li><li>技术分享总结</li><li>杂谈 </li></ul><p><img src="https://github.com/Jazzcharles/Jazzcharles.github.io/raw/master/images/img.jpg" alt="Icon"></p>]]></content>
<summary type="html">
<h1 id="Charles’s-Freetalk"><a href="#Charles’s-Freetalk" class="headerlink" title="Charles’s Freetalk"></a>Charles’s Freetalk</h1><hr>
<p>借
</summary>
</entry>
</feed>