← All tools
EDTOOLKITS GUIDES

Class Balancing: Split First and Keep Replication Provenance

By Team Edtoolkits · Data

Compare random under- and oversampling without leaking duplicate records into evaluation data.

Use the guide alongside the working tool.

Open Class Balance & Resampling →

Explicit working sample

label,x
A,1
A,2
A,3
A,4
B,5
B,6

Inspect class counts and resample training records reproducibly. Training data only: resampling before splitting leaks examples into evaluation sets. Random under/oversampling balances every class to the smallest/largest original class. Seeded deterministic sampling; no synthetic SMOTE. Output includes source row IDs and replication counts, maximum 25,000 output rows.

A comparison to try

For the sample with four A rows and two B rows, undersampling produces two of each, four total. Oversampling produces four of each, eight total. Inspect source-row IDs and total-copy counts to see which records were repeated.

Read the result

The seeded process makes selection reproducible for the same input and settings. Oversampling copies rows; it does not synthesize new information or use SMOTE. Undersampling discards training rows, potentially removing useful variation.

A mistake to avoid

Split before resampling and confirm that only training records are being changed. A balanced count does not prove representative data or fair predictions. Keep evaluation data untouched, and save the seed and provenance with exported training records so later results can be explained.

Prepare the input

Inspect class counts and resample training records reproducibly.

CSV, TSV and arrays of scalar JSON objects are supported. Identifiers stay text. Empty cells are missing by default; add special missing tokens only if their meaning is certain. Use the sample to inspect the exact workflow.

Review the method

Training data only: resampling before splitting leaks examples into evaluation sets. Random under/oversampling balances every class to the smallest/largest original class. Seeded deterministic sampling; no synthetic SMOTE. Output includes source row IDs and replication counts, maximum 25,000 output rows.

Keep the useful output

Review the summary and result records. Transformation tools retain separate change, rejected-record or diagnostics datasets where relevant. Choose the dataset before exporting; a report and a cleaned dataset serve different purposes.

CSV exports protect formula-like text. JSON keeps data portable without making an Excel workbook. Reports and editable backups may contain private source values; download only what you intend to share. No automatic account storage or server processing is used.

Ready to apply this workflow?

Try Class Balance & Resampling →

Explore a related workflow

All practical guides →

Found unclear instructions or an unexpected result? Contact Team Edtoolkits.

YOUR BROWSER, YOUR CHOICE