-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1425 lines (542 loc) · 47.1 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 pisces use-motion">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="/vendors/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="/vendors/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />
<link href="/css/main.css?v=5.0.1" rel="stylesheet" type="text/css" />
<meta name="keywords" content="Hexo, NexT" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.0.1" />
<meta name="description" content="The geek's spirit place">
<meta property="og:type" content="website">
<meta property="og:title" content="Live's blog">
<meta property="og:url" content="http://yoursite.com/index.html">
<meta property="og:site_name" content="Live's blog">
<meta property="og:description" content="The geek's spirit place">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Live's blog">
<meta name="twitter:description" content="The geek's spirit place">
<script type="text/javascript" id="hexo.configuration">
var NexT = window.NexT || {};
var CONFIG = {
scheme: 'Pisces',
sidebar: {"position":"left","display":"post"},
fancybox: true,
motion: true,
duoshuo: {
userId: 0,
author: 'Author'
}
};
</script>
<link rel="canonical" href="http://yoursite.com/"/>
<title> Live's blog </title>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="en">
<div class="container one-collumn 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-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">Live's blog</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle">Tech is the highend direction</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>
<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>
</ul>
</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">
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2016/09/04/Faded/" itemprop="url">
关于技能树的点选问题
</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 itemprop="dateCreated" datetime="2016-09-04T21:47:21+08:00" content="2016-09-04">
2016-09-04
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<hr>
<h2 id="数据的技能树"><a href="#数据的技能树" class="headerlink" title="数据的技能树"></a>数据的技能树</h2><p>看到之前整理的全栈技能树,这两天整理出来了关于数据人员的必备技能树,不多说了直接上图<br><img src="http://ocf3bi6ej.bkt.clouddn.com/data-tree.png" alt="data_tree"><br>总结起来,就是入了数据这个坑,想填还真不是一天两天,沉下心来,毕竟“聒噪的鸟儿飞不高”。</p>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2016/09/04/NaiveBayes/" itemprop="url">
NaiveBayes
</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 itemprop="dateCreated" datetime="2016-09-04T21:25:37+08:00" content="2016-09-04">
2016-09-04
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h2 id="关于朴素贝叶斯"><a href="#关于朴素贝叶斯" class="headerlink" title="关于朴素贝叶斯"></a>关于朴素贝叶斯</h2><p>朴素贝叶斯分类的原理:<br>对于给出的待分类项目,求解在此项出现的条件下各个类别出现的概率,哪个最大,就认为此待分类项就属于哪个分类。<br>在这就不给出贝叶斯定理了,其实还是比较好理解的。</p>
<p>那么对于朴素贝叶斯分类器的包有很多,自己用的比较顺手的是e1071和klaR,这次以e1071为例<br>其中的的主要函数为naiveBayes(formula, data, laplace = 0)<br>formula: 公式的主要形式为type ~ . ,但是相互作用是不允许的(可以参照贝叶斯信念网络)<br>laplace: 正面双控制拉普拉斯平滑,默认值为0表示禁用。<br>data:数据集</p>
<p><code>data("Glass")</code><br><code>model<-naiveBayes( Type ~ .,data = Glass)</code><br><code>prd_test_Glass<-predict(model, Glass[1:10,],tpye = "raw")</code><br><code>prd_test_Glass</code></p>
<p>结果如下<br><code>> prd_test_Glass
[1] 2 1 1 1 1 1 1 1 3 1
Levels: 1 2 3 5 6 7</code></p>
<p>可以看到对于glass的分类有7种,而对于数据集的前十行玻璃的分类结果为: 2 1 1 1 1 1 1 1 3 1<br>那么对比下数据,实际上Glass数据集的前10种玻璃的分类都为1,说明分类失误两个,整体判断的准确率还是有的。</p>
<p>总结一下,之前看到有大神用Titanic数据集做朴素贝叶斯分类,得到最后船上的人符合什么样的条件最容易获救,还是比较有意义的,于是自己做了下进行了对比,并且用了e1071和klaR两个包,结果还是不尽相同的。对于朴素贝叶斯整体而言还能做的还有很多,例如根据用户行为的社交网络、网络游戏的流失分析依然可以用到朴素贝叶斯分类器。</p>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2016/09/02/cowplot/" itemprop="url">
多重图的新纪元-cowplot
</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 itemprop="dateCreated" datetime="2016-09-02T07:54:29+08:00" content="2016-09-02">
2016-09-02
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>说说这两天的新发现-cowplot包,一个在CRAN上的新包,对于其好用的功能且听我细细道来<br>对于R的众多coder来说,郁闷的莫过于不知道该用哪个包来解决手上的问题,但是最郁闷的莫过于知道用哪个包了却不知道怎么用,其实对于cowplot来说由于发布的时间比较新所以中文的相关文档很少,在这我就作为一个贡献者提供些commits,哈哈哈哈。</p>
<h2 id="display0-给ggplot图添加grid"><a href="#display0-给ggplot图添加grid" class="headerlink" title="display0 : 给ggplot图添加grid"></a>display0 : 给ggplot图添加grid</h2><p>这是新鲜刚画出的图,背景blank<br><img src="http://ocf3bi6ej.bkt.clouddn.com/cow_nogrid.png" alt="no_grid"><br>在用到<code>background_grid(major = "xy",minor = "none")</code><br>之后,背景加上了grid,其中major = “xy”是给x和y轴方向添加grid,可以只添加水平或者垂直的grid,只要输入x或者y就行</p>
<h2 id=""><a href="#" class="headerlink" title=""></a><img src="http://ocf3bi6ej.bkt.clouddn.com/cow_grid.png" alt="grid"></h2><h2 id="display1-给ggplot图添加label"><a href="#display1-给ggplot图添加label" class="headerlink" title="display1 : 给ggplot图添加label"></a>display1 : 给ggplot图添加label</h2><p><img src="http://ocf3bi6ej.bkt.clouddn.com/cow_label.png" alt="label"><br>在多图的情况下,给图加label就尤为重要了,这能让每个图更加凸显和容易识别<br><code>plot_grid(test_01, test_02, labels = c("Pic_01", "Pic_02"))</code><br>这次用到的是labels这个参数,已向量的形式给图命名</p>
<h2 id="display2-给ggplot图layout"><a href="#display2-给ggplot图layout" class="headerlink" title="display2 : 给ggplot图layout"></a>display2 : 给ggplot图layout</h2><p>还是在多图的情况下,图的排列就尤为重要,以前R中会用到grid.arrange(),但是这次cowplot提供了好用的plot_grid()<br>具体参数如下<br><code>plot_grid(test_01, NULL,test_02, NULL, labels = c("Pic01", "Pic03", "Pic03", "Pic04"), ncol = 2)</code><br><img src="http://ocf3bi6ej.bkt.clouddn.com/cow_layout_nov.png" alt="label"><br>但是这个时候图与图之间的坐标轴没有对齐,会非常难看,也会看起来不专业<br>在加入align后<br><code>plot_grid(test_01, NULL,test_02, NULL, labels = c("Pic01", "Pic03", "Pic03", "Pic04"), align = "v", ncol = 2)</code></p>
<h2 id="-1"><a href="#-1" class="headerlink" title=""></a><img src="http://ocf3bi6ej.bkt.clouddn.com/cow_layout_v.png" alt="label"></h2><h2 id="display3-给ggplot图加水印"><a href="#display3-给ggplot图加水印" class="headerlink" title="display3 : 给ggplot图加水印"></a>display3 : 给ggplot图加水印</h2><p>图画出来了,可以在必要时刻添加水印,不仅为了防止盗图的,而且还凸显图的比较和分类<br><code>draw_label("Live's chart" , angle = 45, size = 80, alpha = .1)</code><br><img src="http://ocf3bi6ej.bkt.clouddn.com/cow_symbol.png" alt="label"><br>总体来说,cowplot的思想和ggplot2的思想还是比较相近的,在图的pannel上添加层来达到绘图的目的,而且易用性远超之前的方式。</p>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2016/08/29/决策树/" itemprop="url">
决策树-C50
</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 itemprop="dateCreated" datetime="2016-08-29T06:07:55+08:00" content="2016-08-29">
2016-08-29
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>无意间看到data flow上的一个常用的数据集,于是就下了下来,这是一个关于银行客户违约的数据集,这正好让我有了对C5.0实践的一个想法。<br>这个数据集中的字段:账户余额,工作年限,贷款/收入比,居住年限,年龄,其他信用记录,房产,现有贷款账户,工作类型,受抚养人,电话,违约情况<br>下面说一下大体做法<br>‘’ set.seed(1024)#建立种子点<br>‘’ credit_sample <- credit[order(runif(1000)), ]#抽取1000条作为样本</p>
<p>‘’ train <- credit_sample[1:900, ]#按照1:9的比例设立训练集<br>‘’ test <- credit_sample[901:1000, ]#建立测试集</p>
<p>‘’ library(C50)<br>‘’ credit_model <- C5.0(train[-17], train$default)#建立C50模型</p>
<p>‘’ credit_pred <- predict(credit_model, test)#运用测试集来预测结果</p>
<p>具体结果是酱紫:<br>‘’ Total Observations in Table: 100<br>‘’<br>‘’<br>‘’ | predicted default<br>‘’ acutal default | no | yes | Row Total |<br>‘’ —————|———–|———–|———–|<br>‘’ no | 57 | 11 | 68 |<br>‘’ | 0.570 | 0.110 | |<br>‘’ —————|———–|———–|———–|<br>‘’ yes | 16 | 16 | 32 |<br>‘’ | 0.160 | 0.160 | |<br>‘’ —————|———–|———–|———–|<br>‘’ Column Total | 73 | 27 | 100 |<br>‘’ —————|———–|———–|———–|<br>可以看到应用到测试集,该模型正确率73%,只识别了实际违约贷款32人中的50%,显然不够理想。<br>在后期,对于决策树是可以用剪枝来进行修缮的,对于提高准确率,可以运用bagging、boosting和随机森林,特别的可以运用悲观剪枝法来提高模型的准确率,这是一种后剪枝的方法。</p>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2016/08/28/R的骚图绘制/" itemprop="url">
R的骚图绘制
</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 itemprop="dateCreated" datetime="2016-08-28T19:55:42+08:00" content="2016-08-28">
2016-08-28
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>来来来,说到R的绘图那么不得不提的就是ggplot2了,被誉为R中最高大上的绘图系统。对于ggplot2的思想和理念也是由衷的佩服,之前拜读《Elegant Graphics for Data Analysis》的时候就对作者Wickham有着不小的敬畏之心,虽然这本书写的很混乱,但是也让我初识了ggplot2的厉害,之后不断的应用,也让更深层的认识了ggplot2的精髓和思想。<br>想到为了让图画的更加骚气,毫不犹豫的用上了Rcolorbrewer,在不断调试中让图变得更加亮眼<br>对了,对于Rcolorbrewer大家应该都很熟悉,但是可能却不太了解其中的具体信息,其实这个包中有三类调色板,一个是sequential,一个是diverging,还有一个是qualitative,sequential调色板适合用于呈现顺序数据而diverging适合用于处在极端的数值,可以用来强调高低的对比,最后一个qualitative调色板颜色都特别的鲜明,对比度都特别高,所以适合用来呈现分类变量。用brewer.pal.info可以查看详情,display.brewer.pal查看颜色图谱而最关键的是可以与colorRamp/colorRampPalette结合使用。<br>其中会用到scale_color_manual来设置调色板参数<br><img src="http://ocf3bi6ej.bkt.clouddn.com/Rplot03.png" alt="login"><br><img src="http://ocf3bi6ej.bkt.clouddn.com/Rplot_Paired.png" alt="login"><br><img src="http://ocf3bi6ej.bkt.clouddn.com/Rplot02.png" alt="login"><br>其中用到了qualitative调色板中的Paired主题。<br>还可以用玫瑰图绘制,颜色和形状会更加绚丽,待我有空格上更加骚气的图!</p>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2016/08/28/wordcloud2/" itemprop="url">
词云---有意思的呈现
</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 itemprop="dateCreated" datetime="2016-08-28T17:03:16+08:00" content="2016-08-28">
2016-08-28
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>关于R的词云<br>看到最近郎大为的R包出产了,作为一个新的R包特别是在词云解决方案上,已经足够让广大R迷或者说词云粉丝,也或许是段子手们为之兴奋了。<br>对于这次的wordcloud2的出现,外界的评价都特别高,被称为目前最好的词云解决方案。<br>那么先来开膛破肚的介绍下这个包的原理,其实这个新的词云包用的是wordcloud2.js的库,在调用这个库的同时,利用词与词之间的间隔来插入数据,其中一个新的feature是可以根据图片或者文字来定制化词云,其实也就是说可以做到词云的多样化。<br>先来张拿到这个包的上手词云图</p>
<p><img src="http://ocf3bi6ej.bkt.clouddn.com/Rplot.png" alt="login"></p>
<p>这个是用到了其中的核心函数wordcloud2(),在调整了下背景后生成的</p>
<p><img src="http://ocf3bi6ej.bkt.clouddn.com/Rplot01.png" alt="login"></p>
<p>这个是用到了词云包里的新特性,就是根据自己的喜好生成了一幅自己定制词云,这个反战符号是用Sketch手动绘制的,因为比较心焦的想试下新特性,最先想到的就是这个比较简单,并且结构比较鲜明的符号。<br>此次词云包的新特性还有很多情景派的上用场,这让我想到了用户画像的词云定制,特别是在P2P金融的反欺诈用户的画像中,也可以用这种新特性完成,这个词云包简直是个好东西!</p>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2016/08/27/关于时效的SQL代码/" itemprop="url">
关于时效的SQL代码
</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 itemprop="dateCreated" datetime="2016-08-27T11:22:00+08:00" content="2016-08-27">
2016-08-27
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h2 id="产品线的时效问题"><a href="#产品线的时效问题" class="headerlink" title="产品线的时效问题"></a>产品线的时效问题</h2><p>这两天一直受制于各产品的时效问题没有好的方案,起因是需求啊!!还是需求!!老大对于整个产品线的优化问题到了一个新的高度,同行业的审批流程一直在下降,但是对于风控的要求还是不能有过多的取舍,谁让鱼和熊掌不能够兼得,即想有好的MOB数据,又要减少审批时间,那么需求来了,到底应该优化哪个阶段的时效呢?</p>
<p> 于是有了以下的代码</p>
<hr>
<p>‘’ select ‘<br>‘’ 2016-06-12 ‘ as 周期, kx.产品线, kx.初审, sum(kx.初审等待) 初审等待, sum(kx.初审处理)初审处理, sum(时效3) 时效3, count(transport_id) 初审时效处理量<br>‘’ from (<br>‘’ select<br>‘’ transport_id, cs 初审, product as 产品, round(cs_dd,2) as 初审等待 , round(cs_cl,2) as 初审处理, round(cs_dd + cs_cl ,2) as 时效3 ,<br>‘’ (case<br>‘’ when substr(product,0,3) in (’新薪贷’,’精英贷’,’新薪宜’,’助业贷’,’线下金’,’线下信’,’新薪(’,’助业宜’,’MSE’) then ‘城市信贷’<br>‘’ when substr(product,0,3) in (’网商贷’,’乐购分’,’宜学贷’,’pos贷’,’供应链’,’汽车金’,’宜车购’,’企合消费金融’) then ‘渠道’<br>‘’ when substr(product,0,3) in (’线上精’,’线上码’,’新线上’) then ‘宜人线上’<br>‘’ when substr(product,0,3) in (’线上瞬’,’瞬时贷’,’公积金’) then ‘k计划’<br>‘’ else product end) 产品线<br>‘’ from (select transport_id, sum(csdd) as cs_dd , sum(cscl) as cs_cl<br>‘’ from (select transport_id, process_node,<br>‘’ (case when process_node in (‘2-1’,’2-2’,’2-3’,’2-4’) then all_time else 0 end ) as csdd,(case when process_node in (‘2-0’) then all_time else 0 end ) as cscl<br>‘’<br>‘’ from (select transport_id, process_node, s_time, e_time, 24<em>(time1+time2+time3 ) as all_time<br>‘’ from (select transport_id, process_node, s_time, e_time,<br>‘’ (case when to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-03-30 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) then 0<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-03-30 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then 0<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-03-30 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) and to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-03-30 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then 0.375<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-03-30 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) and to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-03-30 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) - to_date(s_time, ‘yyyy-mm-dd hh24:mi:ss’)<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-03-30 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) and to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-03-30 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) - to_date(‘ 2016-03-30 09:30:00’,’yyyy-mm-dd hh24:mi:ss’)<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-03-30 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) and to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-03-30 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then to_date(‘ 2016-03-30 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) - to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) else 0 end ) time1 ,<br>‘’<br>‘’ (case when to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-03-31 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) then 0<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-03-31 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then 0<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-03-31 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) and to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-03-31 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then 0.375<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-03-31 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) and to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-03-31 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) - to_date(s_time, ‘yyyy-mm-dd hh24:mi:ss’)<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-03-31 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) and to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-03-31 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) - to_date(‘ 2016-03-31 09:30:00’,’yyyy-mm-dd hh24:mi:ss’)<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-03-31 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) and to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-03-31 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then to_date(‘ 2016-03-31 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) - to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) else 0 end ) time2 ,<br>‘’<br>‘’ (case when to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-04-01 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) then 0<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-04-01 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then 0<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-04-01 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) and to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-04-01 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then 0.375<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-04-01 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) and to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-04-01 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) - to_date(s_time, ‘yyyy-mm-dd hh24:mi:ss’)<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-04-01 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) and to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) <= to_date(‘ 2016-04-01 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) - to_date(‘ 2016-04-01 09:30:00’,’yyyy-mm-dd hh24:mi:ss’)<br>‘’ when to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-04-01 09:30:00’,’yyyy-mm-dd hh24:mi:ss’) and to_date(e_time,’yyyy-mm-dd hh24:mi:ss’) >= to_date(‘ 2016-04-01 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) then to_date(‘ 2016-04-01 18:30:00’,’yyyy-mm-dd hh24:mi:ss’) - to_date(s_time,’yyyy-mm-dd hh24:mi:ss’) else 0 end ) time3<br>‘’<br>‘’ from (select transport_id from<br>‘’ ( select transport_id,max(decesion_id) as decision_id from clic_sele_v.v_xg_tc_busi_decision<br>‘’ where to_date(inspection_time,’yyyy-mm-dd hh24:mi:ss’)>to_date(‘ 2016-06-08 17:30:01’,’yyyy-mm-dd hh24:mi:ss’) and to_date(inspection_time,’yyyy-mm-dd hh24:mi:ss’)<to_date(' 2016-06-12="" 17:30:00','yyyy-mm-dd="" hh24:mi:ss')="" and="" data_source="2" is_decision="1" group="" by="" transport_id="" )="" ''="" natural="" left="" join="" (select="" transport_id,="" process_node="" from="" min(n_log_id)="" as="" n_log_id="" decision_id,="" flow_log_id="" ,="" (="" select="" transport_id,max(decesion_id)="" decision_id="" clic_sele_v.v_xg_tc_busi_decision="" where="" to_date(inspection_time,'yyyy-mm-dd="">to_date(‘ 2016-06-08 17:30:01’,’yyyy-mm-dd hh24:mi:ss’) and to_date(inspection_time,’yyyy-mm-dd hh24:mi:ss’)<to_date(' 2016-06-12="" 17:30:00','yyyy-mm-dd="" hh24:mi:ss')="" and="" data_source="" in('2','3')="" is_decision="1" group="" by="" transport_id="" )="" ''="" natural="" left="" join="" (select="" decesion_id="" as="" decision_id,="" flow_log_id="" from="" clic_sele_v.v_xg_tc_flow_log)="" ,="" n_log_id="" where="">flow_log_id group by transport_id )<br>‘’ natural left join (select flow_log_id as n_log_id, process_node from clic_sele_v.v_xg_tc_flow_log ) )<br>‘’ natural left join ( select transport_id, min(flow_log_id) as flow_2 from clic_sele_v.v_xg_tc_flow_log where process_node in (‘5-1’,’6-1’,’1-2’,’15-3’) group by transport_id)<br>‘’ where process_node in (‘11-1’,’11-2’,’20-1’) and flow_2 is null )<br>‘’ natural left join<br>‘’<br>‘’ (select transport_id, process_node, s_time1 as s_time,<br>‘’ case when s_time1>=e_time1 and e_time1 is not null then s_time2<br>‘’ else e_time1 end e_time<br>‘’ from ( select rownum+1 rn, transport_id, process_node, s_time1, e_time1<br>‘’ from ( select<br>‘’ transport_id, process_node,<br>‘’ nvl(start_time, create_date) s_time1,<br>‘’ nvl(end_time,assign_time) e_time1<br>‘’ FROM clic_sele_v.v_xg_tc_flow_log<br>‘’ where to_date(create_date,’yyyy-mm-dd hh24:mi:ss’)> to_date(‘2015-10-01 00:00:01’,’yyyy-mm-dd hh24:mi:ss’)<br>‘’ order by transport_id , flow_log_id )<br>‘’ )<br>‘’ natural left join ( select </to_date('></to_date('></em><br>‘’ from ( select rownum rn, s_time2<br>‘’ from<br>‘’ ( select<br>‘’ nvl(start_time, create_date) s_time2<br>‘’ from clic_sele_v.v_xg_tc_flow_log<br>‘’ where to_date(create_date,’yyyy-mm-dd hh24:mi:ss’)> to_date(‘2015-10-01 00:00:01’,’yyyy-mm-dd hh24:mi:ss’)<br>‘’ order by transport_id , flow_log_id )<br>‘’ )<br>‘’ where rn!=1<br>‘’ )<br>‘’ )<br>‘’ ))) group by transport_id )<br>‘’ natural left join ( select transport_id, product_type,submit_dept_no as dept_id from clic_sele_v.v_xg_tc_bs_transport )<br>‘’ natural left join ( select dept_id ,dept_name from clic_sele_v.v_xg_TC_BS_DEPARTMENT )<br>‘’ natural left join ( select system_id as product_type , remark as product from clic_sele_v.v_xg_s_data_dic where system_type=’COMMON_PRODUCT_TYPE’)<br>‘’<br>‘’ natural left join<br>‘’ (select transport_id,beg_jude_name as cs<br>‘’ from<br>‘’ (SELECT transport_id, inspection_man from clic_sele_v.v_xg_tc_busi_decision<br>‘’ where decesion_id in<br>‘’ ( select max(decesion_id) as decision_id from clic_sele_v.v_xg_tc_busi_decision<br>‘’ where data_source=’2’ and is_decision=’1’<br>‘’ group by transport_id ))<br>‘’ natural left join<br>‘’ (select distinct user_code as inspection_man,user_name as beg_jude_name<br>‘’ from clic_sele_v.v_xg_tc_user))<br>‘’ ) kx<br>‘’ group by kx.产品线, kx.初审 </p>
<h2 id="‘’-order-by-kx-产品线"><a href="#‘’-order-by-kx-产品线" class="headerlink" title="‘’ order by kx.产品线 "></a>‘’ order by kx.产品线 </h2><p>不得不说虽然很丑很长,但是,我是说但是,考虑了所有的流程的情况,神马提交的反欺诈、二次协商问题、回退问题等等….统统考虑进去,效率在三分钟以内,对于全线产品来说是通用的!感觉自己的逻辑又有了新的境界!毕竟真的是和一线的审核和系统的技术人员擦出了绳命的火花!</p>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2016/08/23/prototype/" itemprop="url">
部分原型
</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 itemprop="dateCreated" datetime="2016-08-23T21:52:09+08:00" content="2016-08-23">
2016-08-23
</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<p>结游–原型图(部分)</p>
<h2 id="原型"><a href="#原型" class="headerlink" title="原型"></a>原型</h2><p><img src="http://ocf3bi6ej.bkt.clouddn.com/[email protected]" alt="login"><br><img src="http://ocf3bi6ej.bkt.clouddn.com/main.jpg" alt="main"><br><img src="http://ocf3bi6ej.bkt.clouddn.com/%E4%BA%8C%E7%BA%A7%E9%A1%B5%E9%9D%A2.jpg" alt="二级"><br><img src="http://ocf3bi6ej.bkt.clouddn.com/%E4%B8%89%E7%BA%A7%E9%A1%B5%E9%9D%A2.jpg" alt="三级"><br><img src="http://ocf3bi6ej.bkt.clouddn.com/%E4%BA%94%E7%BA%A7%E9%A1%B5%E9%9D%A2.jpg" alt="五级"></p>
</div>
<div>
</div>
<div>
</div>
<footer class="post-footer">
<div class="post-eof"></div>
</footer>
</article>
<article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link" href="/2016/08/22/字段总结/" itemprop="url">
字段总结
</a>