Update Day 1_Data_Preprocessing.ipynb

This commit is contained in:
wengJJ
2018-09-06 21:57:49 +08:00
committed by GitHub
parent 4e56198a4b
commit 52c7628f7c

View File

@ -185,7 +185,7 @@
"metadata": {},
"source": [
"## 第五步:拆分数据集为测试集合和训练集合\n",
"把数据集拆分成两个一个是用来训练模型的训练集合另一个是用来验证模型的测试集合。两者比例一般是80:20。我们导入sklearn.crossvalidation库中的train_test_split()方法。"
"把数据集拆分成两个一个是用来训练模型的训练集合另一个是用来验证模型的测试集合。两者比例一般是80:20。我们导入sklearn.model_selection库中的train_test_split()方法。"
]
},
{
@ -230,14 +230,10 @@
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/ymao/usr/miniconda/lib/python3.6/site-packages/sklearn/cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.\n",
" \"This module will be removed in 0.20.\", DeprecationWarning)\n"
]
}
],
"source": [
"from sklearn.cross_validation import train_test_split\n",
"from sklearn.model_selection import train_test_split\n",
"X_train, X_test, Y_train, Y_test = train_test_split( X , Y , test_size = 0.2, random_state = 0)\n",
"print(\"---------------------\")\n",
"print(\"Step 5: Splitting the datasets into training sets and Test sets\")\n",