Skip to content

Creating bootstrap and jackknife objects. #4

@kylenpayne

Description

@kylenpayne

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions