Skip to content

Add optional seed to get_train_val_test_loader - #254

Open
filipetessaro wants to merge 1 commit into
CederGroupHub:mainfrom
filipetessaro:paper-rerun/split-seed
Open

filipetessaro wants to merge 1 commit into
CederGroupHub:mainfrom
filipetessaro:paper-rerun/split-seed

Conversation

@filipetessaro

Copy link
Copy Markdown

Hi, this adds an optional seed argument to the three get_train_val_test_loader functions in chgnet/data/dataset.py (GraphData, StructureJsonData and the module-level one), as suggested in #253.

With seed=None, the default, nothing changes: the split still uses the global random state, so code that calls random.seed() first gets the same split as before. With an integer, the split comes from random.Random(seed), so a retrain can rebuild the same train/val/test mp-ids without touching global state. Only the split is seeded; DataLoader shuffling inside each set is unchanged.

Added test_data_loader_seed in tests/test_dataset.py (same seed gives the same split, different seeds don't).

This doesn't recover the 0.2.0/0.3.0 test ids from the issue, of course. That part still needs the original lists if you have them.

Report: https://github.com/paper-rerun/paper-rerun/blob/main/reports/2023-deng-chgnet/REPORT.md

This change was prepared with AI agents and reviewed by a human before opening. How we work: https://github.com/paper-rerun/paper-rerun/blob/main/METHOD.md

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 2 high

Results:
2 new issues

Category Results
Security 2 high

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant