Я пытаюсь улучшить свою линейную регрессию, используя вычисления гиперпараметров, и мой код не работает, при записи кода ошибки необходимо указать CV внутри, а внутренние параметры не могут быть найдены в импорте sckit.
Я пытаюсь изменить код без успеха.
from sklearn.model_selection import GridSearchCV
import random
import numpy as np
np.random.seed(3456)
#nr.seed(3456)
## Define the dictionary for the grid search and the model object to search
param_grid = {"M": [0.0001, 0.001, 0.01, 0.1, 1.0,10.0]}
## Define the linear regression model
#lin_mod = linear_model.LogisticRegression(class_weight = {0:0.45, 1:0.55})
lin_mod = linear_model.LinearRegression(fit_intercept = False)
## Perform the grid search over the parameters
clf = ms.GridSearchCV(estimator = lin_mod, param_grid = param_grid, cv = 3,
scoring = 'roc_auc', return_train_score = True)
# Use the inside folds
## Fit the cross validated grid search over the data
clf.fit(train_X, train_y)
## And print the best parameter value
clf.best_estimator_.M