"n_neighbors" pipeline parameter

Hi, get an error on my way to pass on the right parameter into the pipeline:

model = make_pipeline(StandardScaler(), KNeighborsClassifier())

max_depth = [1, 2, 5, 10, 20, 50, 100, 200, 500]

param_name = “n_neighbors”

train_scores, test_scores = validation_curve(
model, data, target, param_name=param_name, param_range=max_depth,
cv=5, scoring=“balanced_accuracy”, n_jobs=1)
train_errors, test_errors = -train_scores, -test_scores

Message: ValueError: Invalid parameter KNeighborsClassifier_n_neighbors for estimator Pipeline(steps=[(‘standardscaler’, StandardScaler()),
(‘kneighborsclassifier’, KNeighborsClassifier())]). Check the list of available parameters with estimator.get_params().keys()

Ok solved using
param_name = “kneighborsclassifier__n_neighbors”

Yes indeed. Be aware that you can use model.get_params() to find the parameter names.

Yes this is what I finally did after realizing that the name had to be specific for pipeline purpose.