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

Creating bootstrap and jackknife objects. #4

Open
kylenpayne opened this issue Sep 13, 2016 · 1 comment
Open

Creating bootstrap and jackknife objects. #4

kylenpayne opened this issue Sep 13, 2016 · 1 comment

Comments

@kylenpayne
Copy link

Hi there,

I love the idea of this package! One thing that I think might be necessary as the number of resampling methods in the package grows is to start to create a more object-oriented framework for the bootstrap, jackknife, etc.

For example, there could be an abstract base class called "Statistic" or "ResampledStatistic", that would represent the base of any of the resampling methods that might be added to this package. Then, there could be Bootstrap, Jackknife, etc... objects that inherit from this class.

Benefits of this approach include --

  • A unified interface for data inputs and functions.
  • A Statistic base class could include methods for dealing with pandas dataframes, ndarrays, matricies, and other special cases which would be inherited by any class that is a sub-class to it, e.g. Bootstrap, Jackknife.
  • A series of specialized functions would be replaced with method calls on an object.

For example, let's say there is a matrix that would you like to sample the rows. Currently, the syntax is

bootstrap_matrixsample(data, axis=0).

But creating a Bootstrap object would lead to something like this.

bstrp = Bootstrap(data)
bstrp.sample(axis=0)

Which would return a sample of the rows in the matrix. If the Statistic base class had code to determine that the data is a matrix, then the user would not have to worry about specifying the correct function for their problem. They would know that the bstrp.sample() functionality works regardless. This functionality is what makes pandas so powerful.

I know there differences seem trivial, but as the code base grows, this sort of framework will really pay dividends, at least in saving your wrists.

I'd be happy to create a new branch and play around with this idea.

@christopherjenness
Copy link
Owner

I think this is a great idea. If you look back at earlier commits, I originally started with this idea, but since the library was so small, I removed it. I think we need to get back to it though. I would be interested to see how you structure it.

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

No branches or pull requests

2 participants