11import pickle
22import typing
3+ import warnings
34
45from sklearn import model_selection
56
@@ -1495,8 +1496,8 @@ def train_test_split(
14951496 environment = None ,
14961497 * ,
14971498 keep_subsampling = False ,
1498- splitter = model_selection .train_test_split ,
1499- ** splitter_kwargs ,
1499+ split_func = model_selection .train_test_split ,
1500+ ** split_func_kwargs ,
15001501 ):
15011502 """Split an environment into a training an testing environments.
15021503
@@ -1512,12 +1513,12 @@ def train_test_split(
15121513 :meth:`DataOp.skb.subsample`), use a subsample of the data. By
15131514 default subsampling is not applied and all the data is used.
15141515
1515- splitter : function, optional
1516+ split_func : function, optional
15161517 The function used to split X and y once they have been computed. By
15171518 default, :func:`~sklearn.model_selection.train_test_split` is used.
15181519
1519- splitter_kwargs
1520- Additional named arguments to pass to the splitter .
1520+ split_func_kwargs
1521+ Additional named arguments to pass to the splitting function .
15211522
15221523 Returns
15231524 -------
@@ -1563,14 +1564,24 @@ def train_test_split(
15631564 >>> accuracy_score(split["y_test"], predictions)
15641565 0.0
15651566 """
1567+ if (splitter := split_func_kwargs .pop ("splitter" , None )) is not None :
1568+ warnings .warn (
1569+ (
1570+ "The `splitter` parameter of `.skb.train_test_split` has been"
1571+ " renamed `split_func`. Using it will raise an error in a future"
1572+ " release of skrub."
1573+ ),
1574+ category = FutureWarning ,
1575+ )
1576+ split_func = splitter
15661577 if environment is None :
15671578 environment = self .get_data ()
15681579 return train_test_split (
15691580 self ._data_op ,
15701581 environment ,
15711582 keep_subsampling = keep_subsampling ,
1572- splitter = splitter ,
1573- ** splitter_kwargs ,
1583+ split_func = split_func ,
1584+ ** split_func_kwargs ,
15741585 )
15751586
15761587 def make_grid_search (self , * , fitted = False , keep_subsampling = False , ** kwargs ):
0 commit comments