#4190·pycaret

[Suggestion]: Bring back 'test_data' or add the ‘stratify’ parameter

Author: guilleplCreated May 14, 2026Updated May 14, 2026
Labelsbug

Pre-flight checklist

  • I have searched existing issues and this isn't a duplicate.
  • I'm reporting against PyCaret 4.0 (the OOP Experiment(...).fit(df) API), not 3.x.
  • I've confirmed the feature I'm asking about is not on the 4.0 kill list (docs/revamp/KILL_LIST.md).

Issue description

Hello! First, thank you for developing Pycaret. I've been working with Pycaret 3.x for some time, and now I'm trying to move to 4.0.

In this process, I have realised that there is no option to split the dataset with stratification (equivalent to train_test_split(stratify=X)) in sklearn), but I can't add my own split data with test_data, similar to Pycaret 3.x.

Minimal reproducible example

python
exp = ClassificationExperiment(
    target="Group",
    train_size=0.7,
    session_id=value,
).fit(dataset)

Expected behavior

I'm not sure if this is the place to ask for something this "small". My suggestion is that it would be convenient to bring back test_data. Or, maybe, adding a new parameter to tasks (ClassificationExperiment in this case) to stratify the data when splitting.

Actual behavior / traceback

python-traceback
Not applicable.

Environment

4.0.0a8 3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)] 1.8.0 2.4.4 3.0.3