๐๐๐ก๐๐๐๐๐
๋๋คํฌ๋ ์คํธ(ํ์ดํผํ๋ผ๋ฏธํฐ) ๋ณธ๋ฌธ
[ ๋ชฉ์ฐจ ]
๋๋คํฌ๋ ์คํธ์ ์ฃผ์ ํ์ดํผํ๋ผ๋ฏธํฐ
- n_estimators : ํธ๋ฆฌ ๊ฐ์
- ๋๋ฌด ์ ์ผ๋ฉด ๊ณผ์์ ํฉ, ๋๋ฌด ๋ง์ผ๋ฉด ํ์ต ์๊ฐ์ด ๊ธธ์ด์ง
- ๊ธฐ๋ณธ๊ฐ : 100
- max_depth : ํธ๋ฆฌ์ ์ต๋ ๊น์ด
- ๋๋ฌด ๊น์ผ๋ฉด ๊ณผ์ ํฉ, ๋๋ฌด ์์ผ๋ฉด ๊ณผ์์ ํฉ
- ๊ธฐ๋ณธ๊ฐ : ์ ํ ์์
- max_features : ์ฌ์ฉํ ์ต๋ ๋ณ์ ๊ฐ์
- ๋ณ์ ๊ฐ์ ์ ํ
- ๋ถ๋ฅ์์๋ sqrt
- ๋ณ์ ๊ฐ ์๊ด์ฑ ๊ณ ๋ ค
- min_samples_split : ๋
ธ๋ ๋ถํ ์ต์ ์ํ ์
- ๊ธฐ๋ณธ ๊ฐ : 2
- min_samples_leaf : ๋ฆฌํ ๋
ธ๋ ์ต์ ์ํ ์
- ๊ธฐ๋ณธ ๊ฐ : 1

๋ฐ์ดํฐ ๋ถ๋ฆฌ
๋ ผ๋ฌธ ์ฐธ๊ณ
https://sejong.dcollection.net/public_resource/pdf/200000630803_20250126185853.pdf
# ์์ ์ฝ๋
from sklearn.model_selection import train_test_split
digits_data = digits.data / 16
X_train, X_test, y_train, y_test = train_test_split(digits_data,digits.target, test_size=0.1)
print(X_train.shape, X_test.shape, y_train.shape,
y_test.shape)
((1617, 64), (180, 64), (1617,), (180,))
from sklearn.model_selection import train_test_split
#train_test_split ํ์ต์ฉ, ํ
์คํธ์ฉ ๋ถ๋ฆฌํ๋ ํจ์
# ํ๊ฒ ๋ณ์์ ์
๋ ฅ ๋ณ์ ๋ถ๋ฆฌ
X = data_new.drop(columns=['ํ์๋งค๋ฌผ์ฌ๋ถ', 'ID', '๊ฒ์ฌ์ผ']) # ์
๋ ฅ๋ณ์
y = data_new['ํ์๋งค๋ฌผ์ฌ๋ถ'] # ํ๊ฒ๋ณ์,y๋ ์์ธกํ ๋์
# ๋ฐ์ดํฐ ๋ถ๋ฆฌ
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.1, random_state=42)
print(X_train.shape, X_test.shape, y_train.shape, y_test.shape)
(2206, 14) (246, 14) (2206,) (246,)
# x-train : ํ์ต์ฉ ๋ฐ์ดํฐ (2206 ์ํ, 14๊ฐ ํน์ง)
# x_test : ํ
์คํธ ๋ฐ์ดํฐ (246 ์ํ, 14๊ฐ ํน์ง)'ํ๋ก์ ํธ๐ ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| ๋จธ์ ๋ฌ๋ ์ํ๋ง (2) | 2025.01.31 |
|---|