-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1350 lines (702 loc) · 44.2 KB
/
index.html
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html class="theme-next gemini" lang="">
<head><meta name="generator" content="Hexo 3.8.0">
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?e9bf4c3313038d6ec4da6e3db746814d";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-129335859-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-129335859-1');
</script>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">
<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
<link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">
<link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css">
<meta name="keywords" content="Hexo, NexT">
<link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico?v=5.1.2">
<meta name="description" content="很惭愧,就做了一点微小的工作。">
<meta name="keywords" content="很惭愧,就做了一点微小的工作。">
<meta property="og:type" content="website">
<meta property="og:title" content="Francis'Blog">
<meta property="og:url" content="http://yoursite.com/index.html">
<meta property="og:site_name" content="Francis'Blog">
<meta property="og:description" content="很惭愧,就做了一点微小的工作。">
<meta property="og:locale" content="default">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Francis'Blog">
<meta name="twitter:description" content="很惭愧,就做了一点微小的工作。">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Gemini',
sidebar: {"position":"left","display":"post","offset":10,"offset_float":12,"b2t":false,"scrollpercent":false,"onmobile":false},
fancybox: true,
tabs: true,
motion: false,
duoshuo: {
userId: '0',
author: 'Author'
},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
}
};
</script>
<link rel="canonical" href="http://yoursite.com/">
<title>Francis'Blog</title>
</head>
<body itemscope="" itemtype="http://schema.org/WebPage" lang="default">
<div class="container sidebar-position-left
page-home
">
<div class="headband"></div>
<header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">Francis'Blog</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle">加油!奋斗!奥里给!</p>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section">
<i class="menu-item-icon fa fa-fw fa-home"></i> <br>
Home
</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories/" rel="section">
<i class="menu-item-icon fa fa-fw fa-th"></i> <br>
Categories
</a>
</li>
<li class="menu-item menu-item-about">
<a href="/about/" rel="section">
<i class="menu-item-icon fa fa-fw fa-user"></i> <br>
About
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section">
<i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
Archives
</a>
</li>
<li class="menu-item menu-item-search">
<a href="javascript:;" class="popup-trigger">
<i class="menu-item-icon fa fa-search fa-fw"></i> <br>
Search
</a>
</li>
</ul>
<div class="site-search">
<div class="popup search-popup local-search-popup">
<div class="local-search-header clearfix">
<span class="search-icon">
<i class="fa fa-search"></i>
</span>
<span class="popup-btn-close">
<i class="fa fa-times-circle"></i>
</span>
<div class="local-search-input-wrapper">
<input autocomplete="off" placeholder="Searching..." spellcheck="false" type="text" id="local-search-input">
</div>
</div>
<div id="local-search-result"></div>
</div>
</div>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<section id="posts" class="posts-expand">
<article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://yoursite.com/2019/12/12/patternrecognition/">
<span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<meta itemprop="name" content="Francis Cheng">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Francis'Blog">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2019/12/12/patternrecognition/" itemprop="url">pattern_recognition</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2019-12-12T10:24:27+08:00">
2019-12-12
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h3 id="‘剪辑KNN条件"><a href="#‘剪辑KNN条件" class="headerlink" title="‘剪辑KNN条件"></a>‘剪辑KNN条件</h3><p>如果样本足够多,就可以重复地执行剪辑程序, 以进一步提高分类性能。称为重复剪辑最近邻法。</p>
<p>KNN被看作一种从样本中获取<strong>最大后验概率</strong>的方法,</p>
<p>剪辑最近邻法可以推广到K-近邻法中,具体是先用k-NN进行剪辑,第二部用1nn算法进行分类 ,当类数增加时,该方法的效果会变得更好。</p>
<p>重复加急最近邻法条件是样本足够多</p>
<h3 id="马氏距离-欧氏距离-明氏距离"><a href="#马氏距离-欧氏距离-明氏距离" class="headerlink" title="马氏距离 欧氏距离 明氏距离"></a>马氏距离 欧氏距离 明氏距离</h3><p>P24</p>
<p>欧式距离具有平移和旋转不变性。</p>
<p>马氏距离对一切<strong>非奇异线性变换</strong>都是不变的。这说明他不受量纲选择的影响。并且平移不变。此外马氏距离对特征的相关性做了处理(计算表达式中有矢量集的样本协方差阵。):对一切非奇异线性变<br>换都是不变的。即,具有坐标系比例、<br>旋转、平移不变性,并且从统计意义<br>上尽量去掉了<strong>分量间的相关性。</strong></p>
<p><img src="1576326533231.png" alt="1576326533231"></p>
<p><img src="1576326558464.png" alt="1576326558464"></p>
<h3 id="感知器算法"><a href="#感知器算法" class="headerlink" title="感知器算法"></a>感知器算法</h3><p>P89</p>
<h3 id="H-K算法优点"><a href="#H-K算法优点" class="headerlink" title="H-K算法优点"></a>H-K算法优点</h3><p><strong>181.基于二次准则函数的H-K算法较之于感知器算法的优点是(BD)?</strong></p>
<p>A.计算量小</p>
<p>B.可以判别问题是否线性可分</p>
<p>C.其解完全适用于非线性可分的情况</p>
<p>D.其解的适应性更好</p>
<h3 id="相似性测度-匹配测度"><a href="#相似性测度-匹配测度" class="headerlink" title="相似性测度 匹配测度"></a>相似性测度 匹配测度</h3><p>P28 Rao测度&Dice测度</p>
<h4 id="Rao"><a href="#Rao" class="headerlink" title="Rao"></a>Rao</h4><p><img src="1576225756744.png" alt="1576225756744"></p>
<p>等于(1-1)匹配测度和所考差的特征数之比</p>
<h4 id="Dice"><a href="#Dice" class="headerlink" title="Dice"></a>Dice</h4><p><img src="1576225955505.png" alt="1576225955505"></p>
<h3 id="fisher判别原理"><a href="#fisher判别原理" class="headerlink" title="fisher判别原理"></a>fisher判别原理</h3><p> 费歇(FISHER)判别思想是投影,使多维问题简化为一维问题来处理。选择一个适当的投影轴,使所有的样品点都投影到这个轴上得到一个投影值。对这个投影轴的方向的要求是:使每一类内的投影值所形成的类内离差尽可能小,而不同类间的投影值所形成的类间离差尽可能大。 </p>
<p> <img src="20170503190745365.png" alt="摘自周志华老师的机器学习"> </p>
<h3 id="判别域界面方程"><a href="#判别域界面方程" class="headerlink" title="判别域界面方程"></a>判别域界面方程</h3><h3 id="聚类分析的分类?"><a href="#聚类分析的分类?" class="headerlink" title="聚类分析的分类?"></a>聚类分析的分类?</h3><p>聚类分析有很多具体的算法,有的比较简单, 有的相对复杂和完善,但归纳起来就是三大类: 1、按最小距离原则简单聚类方法 2、按最小距离原则进行两类合并的方法 3、依据准则函数动态聚类方法 4 近邻函数法</p>
<h3 id="C均值算法影响因素"><a href="#C均值算法影响因素" class="headerlink" title="C均值算法影响因素"></a>C均值算法影响因素</h3><p>受到取定的<strong>类别数</strong>和<strong>初始聚类中心</strong>的影响,通常结果只是局部最优的,但其 方法简单,结果尚令人满意,故应用较多</p>
<p><img src="1576326581752.png" alt="1576326581752"></p>
<h3 id="层次聚类算法例题"><a href="#层次聚类算法例题" class="headerlink" title="层次聚类算法例题"></a>层次聚类算法例题</h3><h3 id="最小误判-最小损失"><a href="#最小误判-最小损失" class="headerlink" title="最小误判 最小损失"></a>最小误判 最小损失</h3><h3 id="为何提出最小损失准则"><a href="#为何提出最小损失准则" class="headerlink" title="为何提出最小损失准则"></a>为何提出最小损失准则</h3><p>从不同性质的错误会引起不同程度的损失这一考虑出发,我们有时宁肯扩大一些总 的错误率,也要使总的损失最小。这就提出 了最小损失准则的决策方法。</p>
<h3 id="最小误判有几种形式"><a href="#最小误判有几种形式" class="headerlink" title="最小误判有几种形式"></a>最小误判有几种形式</h3><p>四种</p>
<p><img src="1576311410009.png" alt="1576311410009"></p>
<h3 id="fisher主要计步骤与分类决策规则"><a href="#fisher主要计步骤与分类决策规则" class="headerlink" title="fisher主要计步骤与分类决策规则"></a>fisher主要计步骤与分类决策规则</h3><p>1,把来自两类omega_1/omega_2的训练样本集X分成omega_1对应的子集X_1和与omega_2对应的子集X_2</p>
<p>2 计算m_i 即平均数</p>
<p>3 计算总的类内离差阵S_w</p>
<p>4 计算S_w的逆矩阵S_w^-1</p>
<p>5 按u = S^-{1}_{w}(m_1 - m_2)</p>
<p>6 计算m一弯和y_t</p>
<p>7 分类 </p>
<p><img src="1576306181726.png" alt="1576306181726"></p>
<p><img src="1576310329922.png" alt="1576310329922"></p>
<h3 id="什么是线性判别函数"><a href="#什么是线性判别函数" class="headerlink" title="什么是线性判别函数"></a>什么是线性判别函数</h3><p> 特征的所在子区域可根据它的特征值代入界面方程的线性函数d(x)后的取值正负而确定,表示界面的线性函数d(x)称为线性判别函数。</p>
<h3 id="线性判决的几何意义"><a href="#线性判决的几何意义" class="headerlink" title="线性判决的几何意义"></a>线性判决的几何意义</h3><p> 运用已知类别的训练样本进行学习产生若干个代数界面d(x)=0,将特征空间划分成一些互不重叠的子区域,使不同的模式类或其主体在不同的子区域中</p>
<p><img src="1576325975691.png" alt="1576325975691"></p>
<h3 id="判决分类结果好坏的标准-一句话"><a href="#判决分类结果好坏的标准-一句话" class="headerlink" title="判决分类结果好坏的标准 一句话"></a>判决分类结果好坏的标准 一句话</h3><p>类内距离小, 类间距离大</p>
<h3 id="最小损失和最小误判的关系"><a href="#最小损失和最小误判的关系" class="headerlink" title="最小损失和最小误判的关系"></a>最小损失和最小误判的关系</h3><p>取0-1损失函数时,最小损失准则等价于最小误<br>判概率准则,此时的平均损失就是误判概率,使平<br>均损失最小即使误判概率最小。这也表明,最小误<br>判概率准则是最小损失准则的特例</p>
<h3 id="最大似然估计和矩估计的概念"><a href="#最大似然估计和矩估计的概念" class="headerlink" title="最大似然估计和矩估计的概念"></a>最大似然估计和矩估计的概念</h3><p>矩法估计是用样本(的统计)矩作为总体(理论)矩的估 值</p>
<p>最大似然估计需要知道概型,据估计不用</p>
<h3 id="聚类分析的使用条件,-条状分布应该用什么算法,-团状用什么算法"><a href="#聚类分析的使用条件,-条状分布应该用什么算法,-团状用什么算法" class="headerlink" title="聚类分析的使用条件, 条状分布应该用什么算法, 团状用什么算法"></a>聚类分析的使用条件, 条状分布应该用什么算法, 团状用什么算法</h3><p>团状用C均值, 条状用近邻 函数法</p>
<p><img src="1576131925604.png" alt="1576131925604"></p>
<h3 id="最小条件损失,-最小损失准则概念"><a href="#最小条件损失,-最小损失准则概念" class="headerlink" title="最小条件损失, 最小损失准则概念"></a>最小条件损失, 最小损失准则概念</h3><p>按照两害相权取其轻原则,所采取的决策应是在统计意义上由于误判而蒙受的损失最小。</p>
<h3 id="C均值重心选择-样本顺序影响因素,选类心的顺序"><a href="#C均值重心选择-样本顺序影响因素,选类心的顺序" class="headerlink" title="C均值重心选择 样本顺序影响因素,选类心的顺序"></a>C均值重心选择 样本顺序影响因素,选类心的顺序</h3><p><img src="1576306938202.png" alt="1576306938202"></p>
<h3 id="相似性测度-匹配距离测度相似测度-劳氏-戴氏"><a href="#相似性测度-匹配距离测度相似测度-劳氏-戴氏" class="headerlink" title="相似性测度 匹配距离测度相似测度 劳氏 戴氏"></a>相似性测度 匹配距离测度相似测度 劳氏 戴氏</h3><h3 id="模式识别系统构成"><a href="#模式识别系统构成" class="headerlink" title="模式识别系统构成"></a>模式识别系统构成</h3><p>特征提取 特征选择 学习和训练 分类识别</p>
<h3 id="层次聚类,算法结果影响的因素"><a href="#层次聚类,算法结果影响的因素" class="headerlink" title="层次聚类,算法结果影响的因素"></a>层次聚类,算法结果影响的因素</h3><p><img src="1576325917801.png" alt="1576325917801"></p>
<h3 id="两类方法处理多分类"><a href="#两类方法处理多分类" class="headerlink" title="两类方法处理多分类"></a>两类方法处理多分类</h3><h3 id="什么是模式识别,对象,特征空间。"><a href="#什么是模式识别,对象,特征空间。" class="headerlink" title="什么是模式识别,对象,特征空间。"></a>什么是模式识别,对象,特征空间。</h3><h4 id="模式识别概念"><a href="#模式识别概念" class="headerlink" title="模式识别概念"></a>模式识别概念</h4><p>根据研究对象的特征或属性,运用一定的 分析算法认定其类别,并且分类识别的结果应 尽可能地符合真实。</p>
<h4 id="特征矢量"><a href="#特征矢量" class="headerlink" title="特征矢量"></a>特征矢量</h4><p>一个分析对象的n个特征量测量值分别为x_1, x_2, … , x_n他们构成一个n维特征矢量x , x = (x_1, x_2, …, x_n)’</p>
<h4 id="特征空间。"><a href="#特征空间。" class="headerlink" title="特征空间。"></a>特征空间。</h4><p>各种不同取值的 的全体构成了 维空间,这 个 维空间称为特征空间,</p>
<h3 id="先验概率、后验概率、类概率密度"><a href="#先验概率、后验概率、类概率密度" class="headerlink" title="先验概率、后验概率、类概率密度"></a>先验概率、后验概率、类概率密度</h3><p><img src="1576313111625.png" alt="1576313111625"></p>
<p><img src="1576313128994.png" alt="1576313128994"></p>
<p><img src="1576313144936.png" alt="1576313144936"></p>
<p> </p>
<h3 id="贝叶斯公式"><a href="#贝叶斯公式" class="headerlink" title="贝叶斯公式"></a>贝叶斯公式</h3><p><img src="1576313170181.png" alt="1576313170181"></p>
<h3 id="NP判决与最小损失,最小误判的异同"><a href="#NP判决与最小损失,最小误判的异同" class="headerlink" title="NP判决与最小损失,最小误判的异同"></a>NP判决与最小损失,最小误判的异同</h3><p><img src="1576313430128.png" alt="1576313430128"></p>
<p><img src="1576326065205.png" alt="1576326065205"></p>
<h3 id="FROM试题"><a href="#FROM试题" class="headerlink" title="FROM试题"></a>FROM试题</h3><p><img src="1576326722883.png" alt="1576326722883"></p>
<p>模式的特性 :可观察性、可区分性、相似性 </p>
<p><img src="1576328261504.png" alt="1576328261504"></p>
<p><img src="1576328667992.png" alt="1576328667992"></p>
<p><img src="1576328751605.png" alt="1576328751605"></p>
<p>答案:约束或限制</p>
<p><img src="1576328808890.png" alt="1576328808890"></p>
<p>答案 </p>
<p><img src="1576328849230.png" alt="1576328849230"></p>
<p>答案:聚类算法</p>
<p><img src="1576397778665.png" alt="1576397778665"></p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://yoursite.com/2019/11/06/hog-extract/">
<span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<meta itemprop="name" content="Francis Cheng">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Francis'Blog">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2019/11/06/hog-extract/" itemprop="url">hog-extract</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2019-11-06T21:34:36+08:00">
2019-11-06
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p><img src="1.png" alt="1"></p>
<p><img src="2.png" alt="2"></p>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
<article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="http://yoursite.com/2019/10/29/elegant-code/">
<span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<meta itemprop="name" content="Francis Cheng">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.jpg">
</span>
<span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Francis'Blog">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2019/10/29/elegant-code/" itemprop="url">elegant-code</a></h1>
<div class="post-meta">
<span class="post-time">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Post created" itemprop="dateCreated datePublished" datetime="2019-10-29T22:18:22+08:00">
2019-10-29
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>统计行数,单词书与字符串数, 这里对单词的定义 比较宽松, 他是任何不包含空格、制表符或者换行符序列。下面这段程序使 UNIX系统中wc程序的骨干部分。</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span><span class="meta-string"><stdio.h></span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> IN 1 <span class="comment">/*inside a word*/</span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> OUT 0 <span class="comment">/*outside a word*/</span></span></span><br><span class="line"><span class="comment">/* count lines, words, and characters in input*/</span></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span>{</span><br><span class="line"> <span class="keyword">int</span> c, nl, nw, nc, state;</span><br><span class="line"> state = OUT;</span><br><span class="line"> nl = nw = nc = <span class="number">0</span>;</span><br><span class="line"> <span class="keyword">while</span>((c==getchar() != EOF)){</span><br><span class="line"> ++nc;</span><br><span class="line"> <span class="keyword">if</span>(c==<span class="string">'\n'</span>)</span><br><span class="line"> ++nl;</span><br><span class="line"> <span class="keyword">if</span>(c==<span class="string">' '</span>|| c==<span class="string">'\n'</span> ||c =<span class="string">'\t'</span>)</span><br><span class="line"> state==OUT;</span><br><span class="line"> <span class="keyword">else</span> <span class="keyword">if</span>(state==OUT){</span><br><span class="line"> state = IN;</span><br><span class="line"> ++nw;</span><br><span class="line"> }</span><br><span class="line"> <span class="built_in">printf</span>(<span class="string">"%d %d %d"</span>, nl, nw, nc);</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</div>
</article>
</section>
<nav class="pagination">
<span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><span class="space">…</span><a class="page-number" href="/page/12/">12</a><a class="extend next" rel="next" href="/page/2/"><i class="fa fa-angle-right"></i></a>
</nav>
</div>
</div>
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
</div>
</div>
<aside id="sidebar" class="sidebar">
<div class="sidebar-inner">
<section class="site-overview sidebar-panel sidebar-panel-active">
<div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
<img class="site-author-image" itemprop="image" src="/images/avatar.jpg" alt="Francis Cheng">
<p class="site-author-name" itemprop="name">Francis Cheng</p>
<p class="site-description motion-element" itemprop="description">很惭愧,就做了一点微小的工作。</p>
</div>
<nav class="site-state motion-element">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">35</span>
<span class="site-state-item-name">posts</span>
</a>
</div>
<div class="site-state-item site-state-categories">
<a href="/categories/index.html">
<span class="site-state-item-count">14</span>
<span class="site-state-item-name">categories</span>
</a>
</div>
<div class="site-state-item site-state-tags">
<a href="/tags/index.html">
<span class="site-state-item-count">16</span>
<span class="site-state-item-name">tags</span>
</a>
</div>
</nav>
<div class="links-of-author motion-element">
</div>
</section>
</div>
</aside>
</div>
</main>
<footer id="footer" class="footer">
<div class="footer-inner">
<div class="copyright">
©
<span itemprop="copyrightYear">2019</span>
<span class="with-love">
<i class="fa fa-heart"></i>
</span>
<span class="author" itemprop="copyrightHolder">Francis Cheng</span>
</div>
<div class="powered-by">
Powered by <a class="theme-link" href="https://hexo.io">Hexo</a>
</div>
<div class="theme-info">
Theme -
<a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
NexT.Gemini
</a>
</div>
</div>
</footer>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
</div>
</div>
<script type="text/javascript">
if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
window.Promise = null;
}
</script>
<script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
<script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
<script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript" src="/js/src/utils.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/motion.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/affix.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.2"></script>