I have some data say 1 million rows, I then put 200k aside (to validate against) and call this remaining 800,000 the training set (X) as you see below, so it is not the entire data and the remaining 200k is the validation set. My question is, is the below grid search ok? My roc curves were extremely high say 0.96. I suspect it is because of the content below, should I instead use grid search on x_train and y_train instead then further split x_train and y_train again to use on pipeline.fit()??
X=pd.read_csv('data_subset.csv')
X=X.dropna()
Y=X['status'].values
X=X.drop(columns=['status'])
x_train, x_test, y_train, y_test = train_test_split(
X, Y, stratify=Y, random_state=42, test_size=0.2)
model = lgb.LGBMClassifier(silent=True, subsample=0.8,colsample_bytree=0.2,objective='binary')
parameters={
'learning_rate_grid_lgbm': [0.015, 0.001, 0.1],
}
i then run grid search on this data:
clf = GridSearchCV(model, parameters, cv=3, scoring='roc_auc')
clf.fit(X, y) ### i.e. instead clf.fit(x_train,y_train)
model = clf.best_estimator_
pipeline = make_pipeline(model)
pipeline.fit(x_train, y_train)
predictions = pipeline.predict_proba(x_test)[:, 1]
roc_auc_score(y_test, predictions)
my confusion is, if I have to use x_train on gridsearch, how should I proceed with the steps after?