[英]scikit-learn GridSearchCV Deprecation Warning
我正在使用來自scikit-learn 0.14的GridSearchCV,但總是得到以下警告:
/Library/Frameworks/EPD64.framework/Versions/7.2/lib/python2.7/site-packages/sklearn/grid_search.py:706:DeprecationWarning:忽略GridSearchCV的其他參數! params參數將在0.15中刪除。 DeprecationWarning)
有誰知道究竟哪些參數被忽略了?
代碼(從文件中讀取x和y):
def balanced_accuracy (ground_truth, predictions):
f00 = 1. * ((ground_truth == 1) & (predictions == 1)).sum() / (ground_truth == 1).sum()
f11 = 1. * ((ground_truth == 2) & (predictions == 2)).sum() / (ground_truth == 2).sum()
return 0.5* (f00 + f11)
bc_score = make_scorer(balanced_accuracy, greater_is_better=True)
C_range = 10. ** np.arange(-3, 3)
gamma_range = 10. ** np.arange(-3, 3)
r_range = np.concatenate((np.array([0]), 10.0 ** np.arange(-1, 3)))
kernel = "poly"
deg = 2
cw = "auto"
param_grid = dict(C=C_range, coef0 = r_range, gamma=gamma_range)
ss = ShuffleSplit(len(y), 10, test_size = 1000, train_size = 1000)
grid = GridSearchCV(svm.SVC(kernel = kernel, max_iter = 1000000, degree = deg, class_weight = cw), param_grid=param_grid, cv=ss, scoring = bc_score)
grid.fit (x, y, sample_weight = sw)
提前致謝!
不推薦使用grid.fit
的sample_weight
參數。 這在文檔中都很明顯,並且通過查看scikit-learn源的0.14.X發布分支 。
在這種情況下,在0.14版本中也會忽略sample_weight,因此grid.fit(x, y sample_weight=sw)
等效於grid.fit(x, y)
。
作為旁注,根據pep-8寫一個好主意。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.