pull/2/head
benjas 5 years ago
parent 31c0dbe61c
commit 5f7a5356e0

@ -238,7 +238,7 @@
} }
], ],
"source": [ "source": [
"data = pd.read_csv('data/train_set.csv')\n", "data = pd.read_csv('data/train_set.csv') # 读取训练数据\n",
"data.head()" "data.head()"
] ]
}, },
@ -490,7 +490,7 @@
} }
], ],
"source": [ "source": [
"data_x = data.loc[:,data.columns != 'label'] # 将数据集分成训练集和预测集\n", "data_x = data.loc[:,data.columns != 'label'] # 将训练数据集分成训练模型和测试集\n",
"data_y = data.loc[:,data.columns == 'label']\n", "data_y = data.loc[:,data.columns == 'label']\n",
"data_x.head()" "data_x.head()"
] ]
@ -2425,7 +2425,7 @@
" pos += 1\n", " pos += 1\n",
" else:\n", " else:\n",
" neg += 1\n", " neg += 1\n",
"all_user_acc = 1.0 * pos / ( pos + neg)\n", "all_user_acc = 1.0 * pos / (pos + neg)\n",
"all_user_recall = 1.0 * pos / len(all_user_set)\n", "all_user_recall = 1.0 * pos / len(all_user_set)\n",
"print ('所有用户中预测购买用户的准确率为 ' + str(all_user_acc))\n", "print ('所有用户中预测购买用户的准确率为 ' + str(all_user_acc))\n",
"print ('所有用户中预测购买用户的召回率' + str(all_user_recall))" "print ('所有用户中预测购买用户的召回率' + str(all_user_recall))"

Loading…
Cancel
Save