Parameters GridSearchCV中的大C参数意味着什么?

Parameters GridSearchCV中的大C参数意味着什么?,parameters,classification,logistic-regression,grid-search,hyperparameters,Parameters,Classification,Logistic Regression,Grid Search,Hyperparameters,我对机器学习及其概念相当陌生,所以澄清一下会有所帮助 我使用逻辑回归来预测二元结果(0或1)。我正在使用GridSearchCV进行一些超参数调优,以找到最佳的C和惩罚参数 为什么我得了这么高的C 高C代表什么 代码: # Setup hyperparameter grid c_space = np.logspace(-5, 8, 15) param_grid = {'C': c_space, 'penalty': ['l1', 'l2']} # Instantiate logistic

我对机器学习及其概念相当陌生,所以澄清一下会有所帮助

我使用逻辑回归来预测二元结果(0或1)。我正在使用GridSearchCV进行一些超参数调优,以找到最佳的
C
惩罚
参数

  • 为什么我得了这么高的C
  • 高C代表什么

代码:

# Setup hyperparameter grid
c_space = np.logspace(-5, 8, 15)
param_grid = {'C': c_space, 'penalty': ['l1', 'l2']}

# Instantiate logistic regression classifier
logreg = LogisticRegression()

# Instantiate GridSearchCV
logreg_cv = GridSearchCV(logreg, param_grid, cv=5)

# Fit to data
logreg_cv.fit(X_train, y_train)

# Print the tuned parameters and score
print("Tuned Logistic Regression Parameters:
      {}".format(logreg_cv.best_params_)) 
print("Best score is {}".format(logreg_cv.best_score_))
输出:

Tuned Logistic Regression Parameters: {'C': 268.26957952797272, 'penalty': 'l2'}
Best score is 0.7974137931034483
因为,C是正则化的逆函数,C越大,正则化越小,意味着你的算法更容易过度拟合数据。因为,C是正则化的逆函数,C越大,正则化越小,意味着你的算法更容易过度拟合数据。