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

Improve Ensemble.batch Custom Function Documentation #321

Closed
wilsonbb opened this issue Dec 9, 2023 · 3 comments
Closed

Improve Ensemble.batch Custom Function Documentation #321

wilsonbb opened this issue Dec 9, 2023 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@wilsonbb
Copy link
Collaborator

wilsonbb commented Dec 9, 2023

Ensemble.batch allows a user to apply custom functions, and the method does this internally by utilizing pandas.Dataframe.apply . Current documentation in my opinion leaves this relationship unclear so that the user will not realize that they need to specify their custom functions in the same way as if they were using apply

Example: A common use case for batch is to produce a result dataframe, however due to apply's behavior, this will only occur if a pd.Series is returned with a list of columns as its data and the column names as its index.

pd.Series([column1_data, column2_data], index=[column1_name, column2_name])

Alternatively we could allow the user to return dataframe by having their function simply return an iterable of the output frame's columns if we pass result_type='expand' when batch calls apply. Regardless if that approach is taken, this behavior should be better documented.

@wilsonbb wilsonbb added documentation Improvements or additions to documentation enhancement New feature or request labels Dec 9, 2023
@dougbrn
Copy link
Collaborator

dougbrn commented Dec 14, 2023

I'm hoping to address this as part of #327, where for one the output of batch will always be a dataframe. And additionally I'm planning to add some kind of "batch showcase" tutorial, where we present a bunch of different styled functions and show how they interact with batch, the idea being that a user should be able to find a function that looks like their function somewhere in that showcase in most cases when trying to learn how to use batch.

@dougbrn dougbrn self-assigned this Dec 14, 2023
@dougbrn
Copy link
Collaborator

dougbrn commented Dec 21, 2023

With #327 merged, batch should now always return a dataframe. Additionally, this PR added a batch function showcase, which walks through several custom function examples, and how batch and it's various kwargs interact with them. @wilsonbb let me know if you think these changes address this issue, or if there's still more to do on this

@wilsonbb
Copy link
Collaborator Author

Thanks, Doug!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants