Xác thực Mô hình trong Python
Kasey Jones
Data Scientist

| Dataset | Định nghĩa |
|---|---|
| Train | Mẫu dữ liệu dùng để fit mô hình |
| Test (mẫu holdout) | Mẫu dữ liệu để đánh giá hiệu năng mô hình |
Ví dụ tỷ lệ
import pandas as pd
tic_tac_toe = pd.read_csv("tic-tac-toe.csv")
X = pd.get_dummies(tic_tac_toe.iloc[:,0:9])
y = tic_tac_toe.iloc[:, 9]
Các khóa Python về biến giả (dummy):
X_train, X_test, y_train, y_test =\
train_test_split(X, y, test_size=0.2, random_state=1111)
Tham số:
test_sizetrain_sizerandom_stateKhi thử các tham số mô hình, ta làm gì?

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)
Xác thực Mô hình trong Python