@@ -329,7 +329,7 @@ def cross_validate(
329329
330330 _warn_or_raise_about_fit_failures (results , error_score )
331331
332- # For callabe scoring, the return type is only know after calling. If the
332+ # For callable scoring, the return type is only know after calling. If the
333333 # return type is a dictionary, the error scores can now be inserted with
334334 # the correct key.
335335 if callable (scoring ):
@@ -1432,6 +1432,26 @@ def _shuffle(y, groups, random_state):
14321432 return _safe_indexing (y , indices )
14331433
14341434
1435+ @validate_params (
1436+ {
1437+ "estimator" : [HasMethods (["fit" ])],
1438+ "X" : ["array-like" , "sparse matrix" ],
1439+ "y" : ["array-like" , None ],
1440+ "groups" : ["array-like" , None ],
1441+ "train_sizes" : ["array-like" ],
1442+ "cv" : ["cv_object" ],
1443+ "scoring" : [StrOptions (set (get_scorer_names ())), callable , None ],
1444+ "exploit_incremental_learning" : ["boolean" ],
1445+ "n_jobs" : [Integral , None ],
1446+ "pre_dispatch" : [Integral , str ],
1447+ "verbose" : ["verbose" ],
1448+ "shuffle" : ["boolean" ],
1449+ "random_state" : ["random_state" ],
1450+ "error_score" : [StrOptions ({"raise" }), Real ],
1451+ "return_times" : ["boolean" ],
1452+ "fit_params" : [dict , None ],
1453+ }
1454+ )
14351455def learning_curve (
14361456 estimator ,
14371457 X ,
@@ -1466,18 +1486,20 @@ def learning_curve(
14661486
14671487 Parameters
14681488 ----------
1469- estimator : object type that implements the "fit" and "predict" methods
1470- An object of that type which is cloned for each validation.
1489+ estimator : object type that implements the "fit" method
1490+ An object of that type which is cloned for each validation. It must
1491+ also implement "predict" unless `scoring` is a callable that doesn't
1492+ rely on "predict" to compute a score.
14711493
1472- X : array-like of shape (n_samples, n_features)
1494+ X : { array-like, sparse matrix} of shape (n_samples, n_features)
14731495 Training vector, where `n_samples` is the number of samples and
14741496 `n_features` is the number of features.
14751497
1476- y : array-like of shape (n_samples,) or (n_samples, n_outputs)
1498+ y : array-like of shape (n_samples,) or (n_samples, n_outputs) or None
14771499 Target relative to X for classification or regression;
14781500 None for unsupervised learning.
14791501
1480- groups : array-like of shape (n_samples,), default=None
1502+ groups : array-like of shape (n_samples,), default=None
14811503 Group labels for the samples used while splitting the dataset into
14821504 train/test set. Only used in conjunction with a "Group" :term:`cv`
14831505 instance (e.g., :class:`GroupKFold`).
0 commit comments