From 65a50dfd422f68ccf35e75e82f3521a70ddf8a2d Mon Sep 17 00:00:00 2001 From: benjas <909336740@qq.com> Date: Mon, 8 Feb 2021 22:27:45 +0800 Subject: [PATCH] Update. some methods --- .../4-模型预测及评估.ipynb | 244 ++++++++++++++++++ 1 file changed, 244 insertions(+) diff --git a/机器学习竞赛实战_优胜解决方案/京东用户购买意向预测/4-模型预测及评估.ipynb b/机器学习竞赛实战_优胜解决方案/京东用户购买意向预测/4-模型预测及评估.ipynb index c442ea5..b6ee0ca 100644 --- a/机器学习竞赛实战_优胜解决方案/京东用户购买意向预测/4-模型预测及评估.ipynb +++ b/机器学习竞赛实战_优胜解决方案/京东用户购买意向预测/4-模型预测及评估.ipynb @@ -21,6 +21,250 @@ "plt.rcParams['axes.unicode_minus']=False" ] }, + { + "cell_type": "code", + "execution_count": 2, + "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", + " \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", + " \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", + " \n", + " \n", + " \n", + " \n", + "
user_idsku_idcateaction_before_3_1.0_xaction_before_3_2.0_xaction_before_3_3.0_xaction_before_3_4.0_xaction_before_3_5.0_xaction_before_3_6.0_xaction_before_3_1.0_y...cate_action_4_meancate_action_5_meancate_action_6_meanhas_bad_commentbad_comment_ratecomment_num_0comment_num_1comment_num_2comment_num_3comment_num_4
0200001.020308.08.00.00.01.00.00.00.00.0...214.800000665.166667185387.2333331.00.01320.00.00.00.01.0
1200001.038604.09.00.00.01.00.00.00.00.0...59.033333106.60000037389.1333331.00.02500.00.00.00.01.0
2200001.0164215.08.00.00.01.00.00.00.00.0...214.800000665.166667185387.2333331.00.03860.00.00.00.01.0
3200002.02866.09.02.00.00.00.00.010.028.0...59.033333106.60000037389.1333330.00.00000.00.00.00.00.0
4200002.03673.09.00.00.00.00.00.04.030.0...59.033333106.60000037389.1333331.00.04360.00.00.00.01.0
\n", + "

5 rows × 236 columns

\n", + "
" + ], + "text/plain": [ + " user_id sku_id cate action_before_3_1.0_x action_before_3_2.0_x \\\n", + "0 200001.0 20308.0 8.0 0.0 0.0 \n", + "1 200001.0 38604.0 9.0 0.0 0.0 \n", + "2 200001.0 164215.0 8.0 0.0 0.0 \n", + "3 200002.0 2866.0 9.0 2.0 0.0 \n", + "4 200002.0 3673.0 9.0 0.0 0.0 \n", + "\n", + " action_before_3_3.0_x action_before_3_4.0_x action_before_3_5.0_x \\\n", + "0 1.0 0.0 0.0 \n", + "1 1.0 0.0 0.0 \n", + "2 1.0 0.0 0.0 \n", + "3 0.0 0.0 0.0 \n", + "4 0.0 0.0 0.0 \n", + "\n", + " action_before_3_6.0_x action_before_3_1.0_y ... cate_action_4_mean \\\n", + "0 0.0 0.0 ... 214.800000 \n", + "1 0.0 0.0 ... 59.033333 \n", + "2 0.0 0.0 ... 214.800000 \n", + "3 10.0 28.0 ... 59.033333 \n", + "4 4.0 30.0 ... 59.033333 \n", + "\n", + " cate_action_5_mean cate_action_6_mean has_bad_comment bad_comment_rate \\\n", + "0 665.166667 185387.233333 1.0 0.0132 \n", + "1 106.600000 37389.133333 1.0 0.0250 \n", + "2 665.166667 185387.233333 1.0 0.0386 \n", + "3 106.600000 37389.133333 0.0 0.0000 \n", + "4 106.600000 37389.133333 1.0 0.0436 \n", + "\n", + " comment_num_0 comment_num_1 comment_num_2 comment_num_3 comment_num_4 \n", + "0 0.0 0.0 0.0 0.0 1.0 \n", + "1 0.0 0.0 0.0 0.0 1.0 \n", + "2 0.0 0.0 0.0 0.0 1.0 \n", + "3 0.0 0.0 0.0 0.0 0.0 \n", + "4 0.0 0.0 0.0 0.0 1.0 \n", + "\n", + "[5 rows x 236 columns]" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data = pd.read_csv('data/test_set.csv') # 读取训练数据\n", + "data.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(270139, 236)" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data.shape" + ] + }, { "cell_type": "code", "execution_count": 2,