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

refactor: fix type hints of train_test_split #161

Closed
wants to merge 3 commits into from
Closed

refactor: fix type hints of train_test_split #161

wants to merge 3 commits into from

Conversation

baggiponte
Copy link
Collaborator

What does this implement/fix? Explain your changes.

Fix the type annotations of train_test_split.

Note. Technically is a breaking change since I made eager a keyword only argument. If we plan to release in 0.10 we should mark it as such. Though I would assume that no one with benign intentions calls train_test_split(4, true).

Technically a breaking change
Copy link

vercel bot commented Jan 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
functime-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 10, 2024 8:38am

@baggiponte baggiponte self-assigned this Jan 7, 2024
@baggiponte baggiponte added the refactor Code change that neither fixes a bug nor adds a feature label Jan 7, 2024
@baggiponte baggiponte added this to the 0.10 milestone Jan 7, 2024
Copy link
Contributor

@FBruzzesi FBruzzesi left a comment

Choose a reason for hiding this comment

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

Following @baggiponte comment, I took a quick look at this and left a comment for the return type in function docstring.

functime/cross_validation.py Outdated Show resolved Hide resolved
@FBruzzesi
Copy link
Contributor

Following @baggiponte comment, I took a quick look at this and left a comment for the return type in function docstring.

Actually let me add some additional comments since I am here 😂

  • The docstring for train_test_split says: """Return a time-ordered train set and test set given test_size.""" which is not accurate as it returns the callable.
  • As the callable is returned, I would add proper docstring to that as well so that one can inspect it if needed

@baggiponte
Copy link
Collaborator Author

Following @baggiponte comment, I took a quick look at this and left a comment for the return type in function docstring.

Actually let me add some additional comments since I am here 😂

  • The docstring for train_test_split says: """Return a time-ordered train set and test set given test_size.""" which is not accurate as it returns the callable.
  • As the callable is returned, I would add proper docstring to that as well so that one can inspect it if needed

Thanks.

I was wondering whether we should remove the eager arg anyway and have a simpler signature def train_test_split[DF: (pl.DataFrame, pl.LazyFrame)](data: DF, ...) -> Callable[[DF], tuple[DF, DF]]: .... No overloads to write.

@baggiponte
Copy link
Collaborator Author

@FBruzzesi I should merge this before you go on with #168. I wanted to discuss with other maintainers @ngriffiths13 whether we can get rid of the eager argument. The reasoning is: if we pass a DataFrame, we return a DataFrame. Same with LazyFrame. In this way, we remove code we have to annotate and test. The user can simply call lazy() or collect() before splitting, if they want.

@baggiponte baggiponte closed this by deleting the head repository Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Code change that neither fixes a bug nor adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants