Change my code to rotate through models but still an error
#test different pre processors model
model = Pipeline(steps=[ ("preprocessor",preprocessor ),
("classifier", KNeighborsClassifier(n_neighbors=5)),
])
from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import QuantileTransformer
from sklearn.preprocessing import PowerTransformer
from sklearn.model_selection import GridSearchCV
from sklearn.model_selection import train_test_split
data_train, data_test, target_train, target_test = train_test_split(
data, target, random_state=42)
all_preprocessors = [
None,
StandardScaler(),
MinMaxScaler(),
QuantileTransformer(n_quantiles=100),
PowerTransformer(method="box-cox"),
for i in range(len(all_processors))
param_grid = {
'preprocessor': All_processors[i],
'classifier__n_neighbors': (5, 51, 101)}
model_grid_search = GridSearchCV(model, param_grid=param_grid,
n_jobs=4, cv=2)
model_grid_search.fit(data_train, target_train)
accuracy = model_grid_search.score(data_test, target_test)
cv_results["test_score"]
and the message is :
File "<ipython-input-4-80c3b4b2092e>", line 23
for i in range(len(all_processors))
^
SyntaxError: invalid syntax