在Scikit中找到最佳超参数时出现ValueError,使用GridSearchCV学习LogisticRegression

时间:2019-05-13 09:43:40

标签: scikit-learn logistic-regression hyperparameters natural-language-processing

在使用GridSearchCV进行LogisticRegression进行超参数调整时,出现以下错误: ValueError: Invalid parameter Hparam

对于估算器:

LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True, intercept_scaling=1, max_iter=100, multi_class='ovr', n_jobs=-1, penalty='l1', random_state=None, solver='liblinear', tol=0.0001, verbose=1, warm_start=False)

我在下面编写了代码:

hparam=[]
a = 0.0001
while(a<100000):
    hparam.append(a)
    a*=2
LReg = LogisticRegression(penalty='l1',verbose=1,n_jobs=-1)
param_grid = {'Hparam':hparam}
grid_ = GridSearchCV(LReg, param_grid, scoring='roc_auc', cv=10)
grid_.fit(xtr_,ytr_)

1 个答案:

答案 0 :(得分:0)

Refer sci-kit Logistic Regression,Hparam未列为Logistic回归的超参数