Skip to content

Commit 6ef6be0

Browse files
committed
Update doc
1 parent bbe1f55 commit 6ef6be0

File tree

2 files changed

+32
-21
lines changed

2 files changed

+32
-21
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
My Python Script
2-
--------
2+
----
3+
34
1. [auc_pr_roc](/auc_pr_roc)
45
Python scikit-learn计算PR ROC曲线AUC值。
56
用于 `携程旅行网 云海竞赛平台` [携程机票航班延误预测算法大赛](https://yunhai.ctrip.com/Games/11),竞赛算法结果核算。
@@ -8,7 +9,7 @@ Python实现 - Excel多文件一键自动合并。
89
3. [geetest_offline](/geetest_offline)
910
Python破解GeeTest滑块验证码offline V5.10.10,以[国家企业信用信息公示系统](http://www.gsxt.gov.cn)网站为例。
1011
4. [geetest_offline_gd](/geetest_offline/README_gd.md)
11-
Python爬虫 - http://gd.gsxt.gov.cn 企业详细信息。
12+
Python爬虫 - [国家企业信用信息公示系统(广东)](http://gd.gsxt.gov.cn) 企业详细信息。
1213
5. [geetest_online](/geetest_online)
1314
Python破解GeeTest滑块验证码online,以[国家企业信用信息公示系统](http://www.gsxt.gov.cn)网站为例。
1415
6. [gitstats](/gitstats)
@@ -29,8 +30,9 @@ MonkeyRunner is DEAD!
2930
前端DevOps之PageSpeed Insights - 使用 Google Cloud Scheduler, Pub/Sub, Functions , Storage 等云服务,搭建 PageSpeed Insights 前端网站网页的质量和性能 benchmark 定时审查系统。与 CI/CD 流程结合,定时大批量审查网站技术性能指标。
3031

3132
License
32-
--------
33-
```
33+
----
34+
35+
```txt
3436
Copyright 2019 ChenQi
3537
3638
Licensed under the Apache License, Version 2.0 (the "License");

auc_pr_roc/README.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
1-
### 背景
2-
[携程旅行网 云海竞赛平台](https://yunhai.ctrip.com)举办算法竞赛,携程机票BU与飞常准合作命题[携程机票航班延误预测算法大赛](https://yunhai.ctrip.com/Games/11),希望以此提升航班延误的预测准确性。
3-
由于云海平台仅支持Python语言,原算法使用R语言实现,因此实现一份Python版,用于竞赛算法的结果核算。
1+
### 背景
2+
3+
[携程旅行网 云海竞赛平台](https://yunhai.ctrip.com)举办算法竞赛,携程机票事业部与飞常准合作命题[携程机票航班延误预测算法大赛](https://yunhai.ctrip.com/Games/11),希望以此提升航班延误的预测准确性。
4+
验收评测竞赛提交算法的结果核算算法使用R语言实现,但云海平台仅支持Python语言,因此实现一份Python版。
5+
46
源数据样本csv格式说明:[航班动态起降数据集](https://www.kesci.com/apps/home/dataset/59793a5a0d84640e9b2fedd3)
57
提交预测样本csv格式说明:[submission_sample.csv](http://ofy9izzlw.bkt.clouddn.com/ctrip_fligtht/submission_sample.csv)
6-
示例:
7-
```
8-
Flightno FlightDepcode FlightArrcode PlannedDeptime PlannedArrtime prob
9-
CA1351 PEK CAN 1496273700 1496285700 0.041386555
10-
8L9647 KMG HIA 1496272200 1496282400 0.022590361
11-
CZ6299 DLC SZX 1496274000 1496286900 0.025210084
12-
HU7377 URC CKG 1496273700 1496287500 0.106757728
13-
```
8+
示例:
9+
10+
Flightno | FlightDepcode | FlightArrcode | PlannedDeptime | PlannedArrtime | prob
11+
-- | -- | -- | -- | -- | --
12+
CA1351 | PEK | CAN | 1496273700 | 1496285700 | 0.041386555
13+
8L9647 | KMG | HIA | 1496272200 | 1496282400 | 0.022590361
14+
CZ6299 | DLC | SZX | 1496274000 | 1496286900 | 0.025210084
15+
HU7377 | URC | CKG | 1496273700 | 1496287500 | 0.106757728
16+
1417
本次比赛采用PR曲线的AUC(baseline:auc=0.45)。
1518
评估指标参考文献:http://mark.goadrich.com/articles/davisgoadrichcamera2.pdf
1619

1720
### 实现
18-
csv文件读取使用pandas库。
21+
22+
csv文件读取使用pandas库。
23+
1924
```Python
2025
def load_label_prob(real_csv, result_csv):
2126
'''读取real.csv和result.csv表格数据的label数组和prob数组'''
@@ -28,7 +33,9 @@ def load_label_prob(real_csv, result_csv):
2833
prob[_i] = round(_e, 4)
2934
return label, prob
3035
```
36+
3137
PR曲线AUC值计算使用sklearn库。
38+
3239
```Python
3340
'''使用real.csv和result.csv列数据,计算PR曲线的AUC值'''
3441
precision, recall, _thresholds = metrics.precision_recall_curve(label, prob)
@@ -37,21 +44,23 @@ return area
3744
```
3845

3946
附:ROC曲线的AUC值计算。
47+
4048
```Python
4149
'''使用real.csv和result.csv列数据,计算ROC曲线的AUC值'''
4250
area = metrics.roc_auc_score(label, prob)
4351
return area
4452
```
4553

4654
### 环境搭建
47-
Windows的scikit-learn库环境搭建略繁琐,对NumPy和SciPy版本有要求。
48-
因此直接使用 http://www.lfd.uci.edu/~gohlke/pythonlibs/ 的第三方预编译库。
49-
```
55+
56+
scikit-learn Windows 环境搭建略繁琐,对 NumPy 和 SciPy 版本有要求。
57+
因此直接使用[第三方预编译库](http://www.lfd.uci.edu/~gohlke/pythonlibs/)
58+
59+
```bash
5060
pip install http://www.lfd.uci.edu/~gohlke/pythonlibs/ru4fxw3r/numpy-1.13.1+mkl-cp36-cp36m-win32.whl
5161
pip install http://www.lfd.uci.edu/~gohlke/pythonlibs/ru4fxw3r/scipy-0.19.1-cp36-cp36m-win32.whl
5262
pip install pandas
5363
pip install scikit-learn
5464
```
5565

56-
### 源码见GitHub
57-
https://github.com/9468305/python-script/blob/master/auc_pr_roc/
66+
### [GitHub源码](https://github.com/9468305/python-script/blob/master/auc_pr_roc/)

0 commit comments

Comments
 (0)