diff --git a/机器学习竞赛实战_优胜解决方案/智慧城市-道路通行时间预测/.ipynb_checkpoints/道路通行时间预测-checkpoint.ipynb b/机器学习竞赛实战_优胜解决方案/智慧城市-道路通行时间预测/.ipynb_checkpoints/道路通行时间预测-checkpoint.ipynb new file mode 100644 index 0000000..2fd6442 --- /dev/null +++ b/机器学习竞赛实战_优胜解决方案/智慧城市-道路通行时间预测/.ipynb_checkpoints/道路通行时间预测-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/机器学习竞赛实战_优胜解决方案/智慧城市-道路通行时间预测/道路通行时间预测.ipynb b/机器学习竞赛实战_优胜解决方案/智慧城市-道路通行时间预测/道路通行时间预测.ipynb new file mode 100644 index 0000000..bfa7f57 --- /dev/null +++ b/机器学习竞赛实战_优胜解决方案/智慧城市-道路通行时间预测/道路通行时间预测.ipynb @@ -0,0 +1,374 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 数据展示" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "from scipy.interpolate import UnivariateSpline\n", + "from sklearn import linear_model\n", + "import xgboost as xgb\n", + "# from ultis import *" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "道路通行时间:" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
link_IDdatetime_intervaltravel_time
043779062834226005142017-05-06[2017-05-06 11:04:00,2017-05-06 11:06:00)3.0
133779062894345105142017-05-06[2017-05-06 10:42:00,2017-05-06 10:44:00)1.0
233779062859345105142017-05-06[2017-05-06 11:56:00,2017-05-06 11:58:00)35.2
333779062859345105142017-05-06[2017-05-06 17:46:00,2017-05-06 17:48:00)26.2
433779062879345105142017-05-06[2017-05-06 10:52:00,2017-05-06 10:54:00)10.4
\n", + "
" + ], + "text/plain": [ + " link_ID date time_interval \\\n", + "0 4377906283422600514 2017-05-06 [2017-05-06 11:04:00,2017-05-06 11:06:00) \n", + "1 3377906289434510514 2017-05-06 [2017-05-06 10:42:00,2017-05-06 10:44:00) \n", + "2 3377906285934510514 2017-05-06 [2017-05-06 11:56:00,2017-05-06 11:58:00) \n", + "3 3377906285934510514 2017-05-06 [2017-05-06 17:46:00,2017-05-06 17:48:00) \n", + "4 3377906287934510514 2017-05-06 [2017-05-06 10:52:00,2017-05-06 10:54:00) \n", + "\n", + " travel_time \n", + "0 3.0 \n", + "1 1.0 \n", + "2 35.2 \n", + "3 26.2 \n", + "4 10.4 " + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df = pd.read_csv('new_gy_contest_traveltime_training_data_second.txt',delimiter=';',dtype={'link_ID':object})\n", + "df.head()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "time_interval时间间隔,两分钟为单位\n", + "\n", + "travel_time平均通行时间" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "道理长宽情况:" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
link_IDlengthwidthlink_class
043779062898695005145731
1437790628459480051424791
2437790628942580051419431
3437790628452580051483931
4437790628442260051455121
\n", + "
" + ], + "text/plain": [ + " link_ID length width link_class\n", + "0 4377906289869500514 57 3 1\n", + "1 4377906284594800514 247 9 1\n", + "2 4377906289425800514 194 3 1\n", + "3 4377906284525800514 839 3 1\n", + "4 4377906284422600514 55 12 1" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "link_df = pd.read_csv('gy_contest_link_info.txt',delimiter=';',dtype={'link_ID':object})\n", + "link_df.head()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "length长度 width宽度 link_class类别" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "道路之间连接情况:" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
link_IDin_linksout_links
0437790628986950051411
1437790628459480051411
2437790628942580051411
3437790628452580051411
4437790628442260051421
\n", + "
" + ], + "text/plain": [ + " link_ID in_links out_links\n", + "0 4377906289869500514 1 1\n", + "1 4377906284594800514 1 1\n", + "2 4377906289425800514 1 1\n", + "3 4377906284525800514 1 1\n", + "4 4377906284422600514 2 1" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "link_tops = pd.read_csv('gy_contest_link_top_update.txt',delimiter=',',dtype={'link_ID':object})\n", + "link_tops.head()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### 任务:预测未来一个月平均通行结果,每两分钟一次\n", + "回归任务\n", + "\n", + "构建时间序列,基于前几天或者前几十天的数据预测" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}