Skip to content

Conversation

stes
Copy link
Member

@stes stes commented Sep 6, 2025

During refactoring of the pivae synthetic data we did not pull over the split function, which causes task.py to fail due to these lines:

train_set.split('train')
valid_set.split('valid')

This pulls over the split function to the main package.

TODO: check if the pivae runs now

@cla-bot cla-bot bot added the CLA signed label Sep 6, 2025
@MMathisLab MMathisLab requested a review from Copilot September 24, 2025 16:38
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a missing split functionality to the synthetic_data module that was accidentally omitted during a refactoring of the pivae synthetic data code, which was causing failures in task.py.

  • Adds a split method to handle train/valid/all data splits
  • Implements 80/20 train/validation split logic
  • Provides compatibility with existing pivae task code

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +118 to +119
train_idx = np.arange(tot_len)[:int(tot_len*0.8)]
valid_idx = np.arange(tot_len)[int(tot_len*0.8):]
Copy link
Preview

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The hardcoded 0.8 split ratio should be extracted as a configurable parameter or class constant to improve maintainability and allow for different split ratios.

Copilot uses AI. Check for mistakes.

if split == 'train':
self.neural = self.neural[train_idx]
self.index = self.index[train_idx]
self.idx = train_idx
Copy link
Preview

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method modifies the instance state by setting self.idx, but this attribute is not defined in init. This could lead to inconsistent state if split() is called multiple times or if other code expects self.idx to always exist.

Copilot uses AI. Check for mistakes.

elif split == 'valid':
self.neural = self.neural[valid_idx]
self.index = self.index[valid_idx]
self.idx = valid_idx
Copy link
Preview

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method modifies the instance state by setting self.idx, but this attribute is not defined in init. This could lead to inconsistent state if split() is called multiple times or if other code expects self.idx to always exist.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants