[Python] ๋จธ์ ๋ฌ๋ 04_์ ํํ๊ท๋ชจ๋ธ, ๋คํญํ๊ท๋ชจ๋ธ(๊ณก์ )
ํ๋ก๊ทธ๋๋ฐ ์ธ๊ณ๋ฅผ ํ๊ตฌํฉ์๋ค. ํ๊ท๋ชจ๋ธ ์ข
๋ฅ ์ ํํ๊ท๋ชจ๋ธ, ๋คํญํ๊ท๋ชจ๋ธ, ๋ค์คํ๊ท๋ชจ๋ธ, ๋ฆฟ์ง, ๋ผ์, ๋๋คํฌ๋ ์คํธ, ๊ทธ๋ ๋์ธํธ๋ถ์คํธ, ํ์คํ ๊ทธ๋จ๊ทธ๋ ๋์ธํธ๋ถ์คํธ, XGBoost, ๊ธฐํ ๋ฑ๋ฑ ์ฃผ๋ก ์ฌ์ฉ๋๋ ํ๊ท๋ชจ๋ธ ๋ฆฟ์ง, ํ์คํ ๊ทธ๋จ๊ทธ๋ ๋์ธํธ๋ถ์คํธ, XGBoost ์ ํํ๊ท๋ชจ๋ธ(LR; Liner Regression Model) ### ๋ชจ๋ธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ถ๋ฌ๋ค์ด๊ธฐ from sklearn.linear_model import LinearRegression ์ฌ์ฉํ ๋ฐ์ดํฐ ### ์ฌ์ฉํ ๋ฐ์ดํฐ train_input, train_target, test_input, test_target ๋ชจ๋ธ ์์ฑํ๊ธฐ ###๋ชจ๋ธ ์์ฑํ๊ธฐ lr = LinearRegression() lr ๋ชจ๋ธ ํ๋ จ์ํค๊ธฐ ### ๋ชจ๋ธ ํ๋ จ์ํค๊ธฐ lr.fit(tra..
2023. 12. 25.
[Python] ๋จธ์ ๋ฌ๋ 03_KNN ํ๊ท๋ชจ๋ธ
ํ๋ก๊ทธ๋๋ฐ ์ธ๊ณ๋ฅผ ํ๊ตฌํฉ์๋ค. KNN ํ๊ท๋ชจ๋ธ ๋ฐ์ดํฐ import numpy as np ### ๋์ด ๊ธธ์ด perch_length = np.array( [8.4, 13.7, 15.0, 16.2, 17.4, 18.0, 18.7, 19.0, 19.6, 20.0, 21.0, 21.0, 21.0, 21.3, 22.0, 22.0, 22.0, 22.0, 22.0, 22.5, 22.5, 22.7, 23.0, 23.5, 24.0, 24.0, 24.6, 25.0, 25.6, 26.5, 27.3, 27.5, 27.5, 27.5, 28.0, 28.7, 30.0, 32.8, 34.5, 35.0, 36.5, 36.0, 37.0, 37.0, 39.0, 39.0, 39.0, 40.0, 40.0, 40.0, 40.0, 42.0, 43..
2023. 12. 22.
[Python] ๋จธ์ ๋ฌ๋ 02_ํ๋ จ ๋ฐ ํ
์คํธ๋ฐ์ดํฐ ๋ถ๋ฅํ๊ธฐ
ํ๋ก๊ทธ๋๋ฐ ์ธ๊ณ๋ฅผ ํ๊ตฌํฉ์๋ค. ํ๋ จ ๋ฐ ํ
์คํธ๋ฐ์ดํฐ ๋ถ๋ฅํ๊ธฐ ํ๋ จ, ๊ฒ์ฆ, ํ
์คํธ ๋ฐ์ดํฐ ๋ถ๋ฅ ์ ์ฃผ๋ก ์ฌ์ฉ๋๋ ๋ณ์๋ช
- ์ ์๋ ๋ณ์ ์ด๋ฆ์ ์์ - ํ๋ จ๋ฐ์ดํฐ : ํ๋ จ(fit)์ ์ฌ์ฉ๋๋ ๋ฐ์ดํฐ : (ํ๋ จ ๋
๋ฆฝ๋ณ์) train_input, train_x, x_train : (ํ๋ จ ์ข
์๋ณ์) train_target, train_y, y_train - ๊ฒ์ฆ๋ฐ์ดํฐ : ํ๋ จ ์ ํ๋(score)์ ์ฌ์ฉ๋๋ ๋ฐ์ดํฐ : (๊ฒ์ฆ ๋
๋ฆฝ๋ณ์) val_input, val_x, x_val : (๊ฒ์ฆ ์ข
์๋ณ์) val_target, val_y, y_val - ํ
์คํธ๋ฐ์ดํฐ : ์์ธก(predict)์ ์ฌ์ฉ๋๋ ๋ฐ์ดํฐ : (ํ
์คํธ ๋
๋ฆฝ๋ณ์) test_input, test_x, x_test : (ํ
์คํธ ์ข
์๋ณ์) test_targ..
2023. 12. 21.