๐ ๊ณต๋ถํ๋ ์ง์ง์ํ์นด๋ ์ฒ์์ด์ง?
๋์ค์ ์ฐธ๊ณ ํ ์ฝ๋ ์์ค ๋ณธ๋ฌธ
728x90
๋ฐ์ํ
๐ฃ ์๊ณ์ด ๋ฐ์ดํฐ ๋น์ทํ ํ์ผ์ ๊ทธ๋ํ ๋ถํฌ๋ก ๋ํ๋ด๊ธฐ
## plot feature data distribution
fig, ax = plt.subplots(2, train.shape[1]//2+1, figsize=(20, 6))
for idx, feature in enumerate(train.columns):
data = train[feature]
if idx<train.shape[1]//2 + 1:
ax[0,idx].hist(train.iloc[:,idx], bins=10, alpha=0.5)
ax[0,idx].set_title(train.columns[idx])
else:
ax[1,idx-train.shape[1]//2-1].hist(train.iloc[:,idx], bins=10, alpha=0.5)
ax[1,idx-train.shape[1]//2-1].set_title(train.columns[idx])
plt.show()
ex) ํ์๊ด ๋ฐ์ ๋ ์์ธก
๐ฃ Optuna ๋ก ํ์ดํผ ํ๋ผ๋ฏธํฐ ํ๋
์ถ์ฒ: https://sswwd.tistory.com/34?category=1194933 [๋ฏผ๊ณต์ง๋ฅ:ํฐ์คํ ๋ฆฌ]
pip install optuna
def objective(trial):
from sklearn.svm import SVC
params = {
'C': trial.suggest_loguniform('C', 0.01, 0.1),
'gamma': trial.suggest_categorical('gamma', ["auto"]),
'kernel': trial.suggest_categorical("kernel", ["rbf"])
}
svc = SVC(**params, verbose=True)
svc.fit(X_train, y_train)
return svc.score(X_test, y_test)
study = optuna.create_study(sampler=optuna.samplers.TPESampler(seed=123),
direction="maximize",
pruner=optuna.pruners.MedianPruner())
study.optimize(objective, n_trials=5, show_progress_bar=True)
print(f"Best Value from optune: {study.best_trial.value}")
print(f"Best Params from optune: {study.best_params}")
728x90
๋ฐ์ํ
'๐ฉโ๐ป ์ปดํจํฐ ๊ตฌ์กฐ > etc' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๋ชจ๋ธ ๋งค๊ฐ๋ณ์ ์ต์ ํ [์ตํฐ๋ง์ด์ , ์์คํจ์, ํ์ดํผํ๋ผ๋ฏธํฐ] (0) | 2022.09.22 |
---|---|
"Ctrl + Shift + R " & "Ctrl + F5" & "F5" ์ฐจ์ด์ (0) | 2022.09.15 |
windows Ubuntu(Linux)์ Anaconda ์ฐ๋ํ๊ธฐ (0) | 2022.09.02 |
windows Ubuntu(Linux)์ VSCode ์ฐ๋ํ๊ธฐ (0) | 2022.09.02 |
windows์ Ubuntu(Linux) ์ค์นํ๊ธฐ with WLS2 (0) | 2022.09.01 |
Comments