Lightning-AI / Lightning-AI/pytorch-lightning

Cross validation built into the framework

Open
#20,544 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Python
Stars
31.4k
Forks
3.8k
Avg merge
6d 7h
Merged PRs (30d)
6

Description

Description & Motivation

Cross validation is standard practice in many cases.
I personally use it to have higher confidence in models with borderline amounts of data.

There is currently no way built in way to do this using lightning/lightning CLI
What I'm currently doing is passing the fold index manually as an argument and then the datamodule handle the fold creation.

Pitch

The ideal scenario in my opinion would be to have fold_enabled data modules that generate different train/validation/test sets based on a fold index parameter passed by lightning.

This will allow the user to maintain full control over fold selection and splitting while treating the cross fold validation as a single run.

Alternatives

No response

Additional context

No response

cc @lantiga @borda

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Lightning CLI entry point and the datamodule handling described in the issue, including how a fold index is currently passed manually. Define how fold-enabled datamodules would receive that index and how one run would control the train, validation, and test splits; done means cross-validation works while preserving user control over fold selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.