| 2050 | 2050 |
"metadata": {},
|
| 2051 | 2051 |
"outputs": [],
|
| 2052 | 2052 |
"source": [
|
| 2053 | |
"# 2.数据划分\n",
|
| 2054 | 2053 |
"from sklearn.model_selection import train_test_split\n",
|
| 2055 | 2054 |
"X_train,X_test,Y_train,Y_test = train_test_split(X, y, test_size=0.1, random_state=0)\n"
|
| 2056 | 2055 |
]
|
|
| 2106 | 2105 |
"metadata": {},
|
| 2107 | 2106 |
"outputs": [],
|
| 2108 | 2107 |
"source": [
|
| 2109 | |
"# 5.模型评估\n",
|
| 2110 | 2108 |
"print(\"\\n得出来的权重:\", estimator.coef_)\n",
|
| 2111 | 2109 |
"print(\"\\nLogistic Regression模型训练集的准确率:%.1f%%\" %(estimator.score(X_train, Y_train)*100))"
|
| 2112 | 2110 |
]
|