<jupyter_start><jupyter_text>Tuning parameters<jupyter_code>from sklearn.preprocessing import MinMaxScaler
from sklearn.preprocessing import QuantileTransformer
from sklearn.preprocessing import PowerTransformer


all_preprocessors = [
    None,
    StandardScaler(),
    MinMaxScaler(),
    QuantileTransformer(n_quantiles=100),
    PowerTransformer(method="box-cox"),
]
model.get_params()
from sklearn.model_selection import GridSearchCV

parameters = [{
    'preprocessor':all_preprocessors,
    'classifier__n_neighbors':[5, 51, 101]
}]

model_search = GridSearchCV(model, parameters, scoring="balanced_accuracy",
                           cv=10).fit(data, target)
model_search.best_params_

cv_results = pd.DataFrame(model_search.cv_results_).sort_values(
    "mean_test_score", ascending=False)
cv_results<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09619952494061758, 'fraction_numerical': 0.013064133016627079, 'mean_word_length': 5.798387096774194, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '444904', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 281, 'n_tokens_neox': 267, 'n_words': 41, 'path': 'my_solutions/third_quiz.ipynb', 'repo_name': 'Enriquesec/scikit-learn-mooc', 'size': '842'}