-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.xml
84 lines (46 loc) · 10.4 KB
/
atom.xml
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
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>zhouzhongmi</title>
<link href="/atom.xml" rel="self"/>
<link href="http://www.zhouzhongmi.com/"/>
<updated>2018-05-20T06:33:35.070Z</updated>
<id>http://www.zhouzhongmi.com/</id>
<author>
<name>Mi Zhou</name>
</author>
<generator uri="http://hexo.io/">Hexo</generator>
<entry>
<title>Introduction to Functional Interfaces – A concept recreated in Java 8</title>
<link href="http://www.zhouzhongmi.com/2018/05/20/Introduction-to-Functional-Interfaces-%E2%80%93-A-concept-recreated-in-Java-8/"/>
<id>http://www.zhouzhongmi.com/2018/05/20/Introduction-to-Functional-Interfaces-–-A-concept-recreated-in-Java-8/</id>
<published>2018-05-20T06:32:41.000Z</published>
<updated>2018-05-20T06:33:35.070Z</updated>
<content type="html"><![CDATA[<h2 id="Introduction-to-Functional-Interfaces-–-A-concept-recreated-in-Java-8"><a href="#Introduction-to-Functional-Interfaces-–-A-concept-recreated-in-Java-8" class="headerlink" title="Introduction to Functional Interfaces – A concept recreated in Java 8"></a>Introduction to Functional Interfaces – A concept recreated in Java 8</h2><p><a href="https://sanaulla.info/2013/03/21/introduction-to-functional-interfaces-a-concept-recreated-in-java-8/" target="_blank" rel="noopener">原文地址</a></p><p><strong><em>Interpreted by zhouzhongmi</em></strong></p><p>全世界的Java开发者都至少使用过一次下面的接口:</p><ul><li>java.lang.Runnable</li><li>java.awt.event.ActionListener</li><li>java.util.Comparator</li><li>java.concurrent.Callable</li></ul><p>这些接口具有一个共同的特点,那就是每个接口定义中只声明了一个方法,在JDK中有很多这样的接口,并且java开发者定义了更多这样的接口,这些方法也叫作单抽象方法接口(<strong>S</strong>ingle <strong>A</strong>bstract <strong>M</strong>ethod interfaces,<strong>SAM</strong> interfaces),实现这类接口的一个匿名的内部类是使用这类接口的一个常用方式:</p><pre><code>public class AnonymousInnerClassTest { public static void main(String[] args) { new Thread(new Runnable() { @Override public void run() { System.out.println("A thread created and running ..."); } }).start(); }}</code></pre><p>在Java8中,这类被重新创造的单方法接口被叫做<strong>Functional interfaces</strong>(函数式接口),它们能用Lambda表达式、方法引用和构造函数引用进行表示(作者会在随后的博客中讨论这两个主题)。 这里引入了一个注解<strong>@FunctionalInterface</strong>,用于在编译期检测修饰的接口是否是一个函数式接口。 让我们来看看只有单个抽象方法的函数是接口:</p><pre><code>@FunctionalInterfacepublic interface SimpleFuncInterface { public void doWork();}</code></pre><p>在声明了单抽象方法的接口中,即使同时声明了来自java.lang.Object中的抽象方法,也仍然是函数式接口:</p><pre><code>@FunctionalInterfacepublic interface SimpleFuncInterface { public void doWork(); public String toString(); public boolean equals(Object o);}</code></pre><p>当你在函数式接口中声明了另外的抽象方法时,编译器或IDE会提示错误:<br><img src="https://sanaulla.files.wordpress.com/2013/03/funcinterface_error1.jpg" alt=""></p><p>当子接口继承了函数式接口后,没有添加任何抽象方法,那么子接口也是函数式接口。 接口如果只有一个抽象方法和若干个默认方法,仍然可以称作是函数式接口。</p><pre><code>@FunctionalInterfacepublic interface ComplexFunctionalInterface extends SimpleFuncInterface { default public void doSomeWork(){ System.out.println("Doing some work in interface impl..."); } default public void doSomeOtherWork(){ System.out.println("Doing some other work in interface impl..."); }}</code></pre><p>上面的接口仍然是一个合法的函数式接口。 下面让我们来看看lambda表达式和匿名内部类如何实现函数式接口:</p><pre><code>/** Implementing the interface by creating an* anonymous inner class versus using * lambda expression.*/public class SimpleFunInterfaceTest { public static void main(String[] args) { carryOutWork(new SimpleFuncInterface() { @Override public void doWork() { System.out.println("Do work in SimpleFun impl..."); } }); carryOutWork(() -> System.out.println("Do work in lambda exp impl...")); } public static void carryOutWork(SimpleFuncInterface sfi){ sfi.doWork(); }}</code></pre><p>输出为:</p><pre><code>Do work in SimpleFun impl...Do work in lambda exp impl...</code></pre><p>如果你使用的IDE支持lambda表达式语法检测,那么像上面那样在使用匿名内部类时会进行提示:<br><img src="https://sanaulla.files.wordpress.com/2013/03/funcinterface_hint.jpg" alt=""></p><p>上面只是对Java8中函数式接口概念及其如何使用lambda实现的一个简短介绍。</p>]]></content>
<summary type="html">
<h2 id="Introduction-to-Functional-Interfaces-–-A-concept-recreated-in-Java-8"><a href="#Introduction-to-Functional-Interfaces-–-A-concept-r
</summary>
<category term="Functional Interfaces" scheme="http://www.zhouzhongmi.com/tags/Functional-Interfaces/"/>
</entry>
<entry>
<title>Support vector machine</title>
<link href="http://www.zhouzhongmi.com/2018/05/14/Support-vector-machine/"/>
<id>http://www.zhouzhongmi.com/2018/05/14/Support-vector-machine/</id>
<published>2018-05-14T09:00:22.000Z</published>
<updated>2018-05-14T09:00:49.911Z</updated>
<content type="html"><![CDATA[<h2 id="支持向量机(SVM)"><a href="#支持向量机(SVM)" class="headerlink" title="支持向量机(SVM)"></a>支持向量机(SVM)</h2><h3 id="本质"><a href="#本质" class="headerlink" title="本质"></a>本质</h3><p>将低维线性不可分样本空间映射到高维线性可分的空间,找到最优的线性分类面(hyper plane),借助核函数进行低维到高维空间的映射,以及将高维空间内向量的内积简化为低维空间向量的内积运算。</p><p>其中,在寻找最优分类面时,根据间距最小,推导出目标函数和约束条件,继而转化为二次优化问题,在原问题满足KKT条件时,获得原优化问题的对偶问题,求解对偶问题获得局部或全局最优解,即可求得原问题的局部或全局最优解。</p><h3 id="分析步骤"><a href="#分析步骤" class="headerlink" title="分析步骤"></a>分析步骤</h3><ol><li>使用<strong>R^n</strong>维向量描述样本特征,也即是样本特征向量的选取和归一化;</li><li>根据样本类别设置分类标签;</li><li>选取核函数和对应模型参数;</li><li>对测试数据进行模型训练和交叉验证,评价模型效果;</li><li>对未知数据进行预测;</li></ol>]]></content>
<summary type="html">
<h2 id="支持向量机(SVM)"><a href="#支持向量机(SVM)" class="headerlink" title="支持向量机(SVM)"></a>支持向量机(SVM)</h2><h3 id="本质"><a href="#本质" class="headerli
</summary>
</entry>
<entry>
<title>Hello World</title>
<link href="http://www.zhouzhongmi.com/2018/05/14/hello-world/"/>
<id>http://www.zhouzhongmi.com/2018/05/14/hello-world/</id>
<published>2018-05-14T05:57:36.025Z</published>
<updated>2018-05-14T05:57:36.025Z</updated>
<content type="html"><![CDATA[<p>Welcome to <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/" target="_blank" rel="noopener">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html" target="_blank" rel="noopener">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="noopener">GitHub</a>.</p><h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">"My New Post"</span></span><br></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/writing.html" target="_blank" rel="noopener">Writing</a></p><h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/server.html" target="_blank" rel="noopener">Server</a></p><h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/generating.html" target="_blank" rel="noopener">Generating</a></p><h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/deployment.html" target="_blank" rel="noopener">Deployment</a></p>]]></content>
<summary type="html">
<p>Welcome to <a href="https://hexo.io/" target="_blank" rel="noopener">Hexo</a>! This is your very first post. Check <a href="https://hexo.
</summary>
</entry>
</feed>