การตรวจสอบความถูกต้องของโมเดลใน Python
Kasey Jones
Data Scientist

| ชุดข้อมูล | ความหมาย |
|---|---|
| Train | ข้อมูลตัวอย่างที่ใช้ในการ fit โมเดล |
| Test (holdout sample) | ข้อมูลตัวอย่างที่ใช้ประเมินประสิทธิภาพของโมเดล |
ตัวอย่างอัตราส่วน
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]
คอร์ส Python ที่ครอบคลุมเรื่อง dummy variables:
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