@@ -397,11 +397,16 @@ def cross_validate(
397
397
# `process_routing` code, we pass `fit` as the caller. However,
398
398
# the user is not calling `fit` directly, so we change the message
399
399
# to make it more suitable for this case.
400
+ unrequested_params = sorted (e .unrequested_params )
400
401
raise UnsetMetadataPassedError (
401
402
message = (
402
- f"{ sorted (e .unrequested_params .keys ())} are passed to cross"
403
- " validation but are not explicitly requested or unrequested. See"
404
- " the Metadata Routing User guide"
403
+ f"{ unrequested_params } are passed to cross validation but are not"
404
+ " explicitly set as requested or not requested for cross_validate's"
405
+ f" estimator: { estimator .__class__ .__name__ } . Call"
406
+ " `.set_fit_request({{metadata}}=True)` on the estimator for"
407
+ f" each metadata in { unrequested_params } that you"
408
+ " want to use and `metadata=False` for not using it. See the"
409
+ " Metadata Routing User guide"
405
410
" <https://scikit-learn.org/stable/metadata_routing.html> for more"
406
411
" information."
407
412
),
@@ -1238,13 +1243,17 @@ def cross_val_predict(
1238
1243
# `process_routing` code, we pass `fit` as the caller. However,
1239
1244
# the user is not calling `fit` directly, so we change the message
1240
1245
# to make it more suitable for this case.
1246
+ unrequested_params = sorted (e .unrequested_params )
1241
1247
raise UnsetMetadataPassedError (
1242
1248
message = (
1243
- f"{ sorted (e .unrequested_params .keys ())} are passed to cross"
1244
- " validation but are not explicitly requested or unrequested. See"
1245
- " the Metadata Routing User guide"
1246
- " <https://scikit-learn.org/stable/metadata_routing.html> for more"
1247
- " information."
1249
+ f"{ unrequested_params } are passed to `cross_val_predict` but are"
1250
+ " not explicitly set as requested or not requested for"
1251
+ f" cross_validate's estimator: { estimator .__class__ .__name__ } Call"
1252
+ " `.set_fit_request({{metadata}}=True)` on the estimator for"
1253
+ f" each metadata in { unrequested_params } that you want to use and"
1254
+ " `metadata=False` for not using it. See the Metadata Routing User"
1255
+ " guide <https://scikit-learn.org/stable/metadata_routing.html>"
1256
+ " for more information."
1248
1257
),
1249
1258
unrequested_params = e .unrequested_params ,
1250
1259
routed_params = e .routed_params ,
0 commit comments