Python 中的模型验证
Kasey Jones
Data Scientist

| 数据集 | 定义 |
|---|---|
| 训练集 | 拟合模型时使用的数据样本 |
| 测试集(留出样本) | 评估模型性能的数据样本 |
比例示例
X_train, X_test, y_train, y_test =\
train_test_split(X, y, test_size=0.2, random_state=1111)
参数:
test_sizetrain_sizerandom_state测试不同模型参数时怎么办?

X_temp, X_test, y_temp, y_test =\
train_test_split(X, y, test_size=0.2, random_state=1111)
X_train, X_val, y_train, y_val =\
train_test_split(X_temp, y_temp, test_size=0.25, random_state=11111)
Python 中的模型验证