์ฃ์กํฉ๋๋ค. ๊ฒ์ํ ์์น๊ฐ ์๋ชป๋ ๊ฒฝ์ฐ์ ๋๋ค. ๋ด ์ฝ๋:
from sklearn import datasets, linear_model, cross_validation, grid_search
import numpy as np
digits = datasets.load_digits()
x = digits.data[:1000]
y = digits.target[:1000]
kf_total = cross_validation.KFold(len(x), n_folds=10, indices=True, shuffle=True, random_state=4)
lr = linear_model.LogisticRegression()
c_range = np.logspace(0, 4, 10)
lrgs = grid_search.GridSearchCV(estimator=lr, param_grid=dict(C=c_range), n_jobs=1)
results_lrgs = cross_validation.cross_val_score(lrgs, x, y, cv=kf_total, n_jobs=1)
print lrgs.best_params_
์ค๋ฅ:
Traceback (most recent call last):
File "cross.py", line 11, in <module>
print lrgs.best_params_
AttributeError: 'GridSearchCV' object has no attribute 'best_params_'
๋ด๊ฐ ๋ฌด์์ ๋์น๊ณ ์์ต๋๊น?
ํ์ ๋ถ๋ฅด์ง ์์ผ์
จ์ฃ ?
2014๋
6์ 26์ผ ์คํ 4์ 36๋ถ, "Vitor Campos de Oliveira" <
[email protected]>์ ๋ค์๊ณผ ๊ฐ์ด ์ผ์ต๋๋ค.
์ฃ์กํฉ๋๋ค. ๊ฒ์ํ ์์น๊ฐ ์๋ชป๋ ๊ฒฝ์ฐ์ ๋๋ค. ๋ด ์ฝ๋:
sklearn ๊ฐ์ ธ์ค๊ธฐ ๋ฐ์ดํฐ ์ธํธ์์, linear_model, cross_validation, grid_search
numpy๋ฅผ np๋ก ๊ฐ์ ธ์ค๊ธฐ
์ซ์ = dataset.load_digits()
x = ์ซ์.๋ฐ์ดํฐ[:1000]
y = ์ซ์.๋์[:1000]
kf_total = cross_validation.KFold(len(x), n_folds=10, ์ธ๋ฑ์ค=True,
์ ํ=์ฐธ, random_state=4)
lr = linear_model.LogisticRegression()
c_range = np.logspace(0, 4, 10)
lrgs = grid_search.GridSearchCV(estimator=lr, param_grid=dict(C=c_range),
n_์์ =1)
๊ฒฐ๊ณผ_lrgs = cross_validation.cross_val_score(lrgs, x, y, cv=kf_total,
n_์์ =1)
lrgs.best_params_ ์ธ์์ค๋ฅ:
์ญ์ถ์ (๊ฐ์ฅ ์ต๊ทผ ํธ์ถ ๋ง์ง๋ง):
ํ์ผ "cross.py", 11ํ,
lrgs.best_params_ ์ธ์
AttributeError: 'GridSearchCV' ๊ฐ์ฒด์ 'best_params_' ์์ฑ์ด ์์ต๋๋ค.๋ด๊ฐ ๋ฌด์์ ๋์น๊ณ ์์ต๋๊น?
โ
์ด ์ด๋ฉ์ผ์ ์ง์ ๋ต์ฅํ๊ฑฐ๋ GitHub์์ ํ์ธํ์ธ์.
https://github.com/scikit-learn/scikit-learn/issues/3320.
์ข์์. =\ ํ์ ์์ด๋ฒ๋ ธ์ต๋๋ค. ์๋๋ ์์ค ๊ฐ์ฌํฉ๋๋ค.
์ผ๋ง๋ ๊ฑธ๋ฆด๊น์?
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
ํ์ ๋ถ๋ฅด์ง ์์ผ์ จ์ฃ ?
2014๋ 6์ 26์ผ ์คํ 4์ 36๋ถ, "Vitor Campos de Oliveira" <
[email protected]>์ ๋ค์๊ณผ ๊ฐ์ด ์ผ์ต๋๋ค.