Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed time_cutoff option #89

Merged
merged 7 commits into from
Mar 26, 2024
Merged

changed time_cutoff option #89

merged 7 commits into from
Mar 26, 2024

Conversation

kierandidi
Copy link
Collaborator

@a-r-j

Added option for the PDBDataModule to create splits based on time interval by exposing PDBManager functionality.

Tested both this functionality as well as random and sequence_similarity to ensure no regression is happening

log.info(f"Splitting dataset via time_cutoff split into {self.train_val_test}...")
log.info(f"Using {self.split_time_frames} dates for split")
pdb_manager.split_time_frames = self.split_time_frames
splits = pdb_manager.split_by_deposition_date(df=pdb_manager.df, update=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very nice!

@amorehead
Copy link
Collaborator

LGTM

split_sequence_similiarity: 0.3 # Clustering at 30% sequence similarity (argument is ignored if split_type="random")
split_type: "sequence_similarity" # Split sequences by sequence similarity clustering, other options are "random" and "time_cutoff"
split_sequence_similiarity: 0.3 # Clustering at 30% sequence similarity (argument is ignored if split_type!="sequence_similarity")
split_time_frames: ["2020-01-01", "2021-01-01", "2023-03-01"] # Time-cutoffs for train, val and test set (argument is ignored if split_type!="time_cutoff")
Copy link
Owner

Choose a reason for hiding this comment

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

Better to set to null? What do you thinl?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

you mean split_time_frames? Thought it would be good to have it in there so that users can see what format is required

Copy link
Collaborator

@amorehead amorehead Mar 24, 2024

Choose a reason for hiding this comment

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

Perhaps you can null out split_time_frames but leave your example in the in-line comment as follows:

split_time_frames: null # Time-cutoffs for train, val and test set (argument is ignored if split_type!="time_cutoff") - e.g., ["2020-01-01", "2021-01-01", "2023-03-01"]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Collaborator

Choose a reason for hiding this comment

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

LGTM

split_sequence_similiarity: int,
overwrite_sequence_clusters: bool
overwrite_sequence_clusters: bool,
split_time_frames: List[str]
Copy link
Owner

Choose a reason for hiding this comment

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

Should be Optional[List[str]]. This arg probs needs a check for datetime format.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In theory it is optional, but we cannot specify a default option as it is later in the argument list. If we want to make the type hint optional, should we move it up the list and give it a default value?

Copy link
Owner

Choose a reason for hiding this comment

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

Hmm, I'm generally in favour of fewer args (and not passing in things that aren't used since it can be confusing). What do you think about a pattern where we can pass the time splits into train_test_split instead of the list of floats and the behaviour is controlled by split_type (with appropriate error catching)?

Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

With pass the time splits into train_test_split, do you mean giving tuples of (split_ratio, split_time_cutoff) if the time version is chosen for example? And if the time version is not chosen, one would just take the first element of that tuple, with the default for the second being None?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, I think clarification would be helpful here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Was not sure what exactly you meant @a-r-j, but for now, I just reordered arguments so that we can give defaults to these and the user does not need to specify them. Does that work for you?

Copy link
Owner

@a-r-j a-r-j left a comment

Choose a reason for hiding this comment

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

LGTM

@a-r-j
Copy link
Owner

a-r-j commented Mar 26, 2024

Ah, some tests are failing @kierandidi

@kierandidi
Copy link
Collaborator Author

should be fixed now @a-r-j

@amorehead amorehead merged commit a891666 into main Mar 26, 2024
8 checks passed
@amorehead amorehead deleted the time_splits branch March 26, 2024 23:34
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.

3 participants