-
Notifications
You must be signed in to change notification settings - Fork 3
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
Ensemble Methods to retrieve a data subset #361
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2bcb5a3
WIP: Ensemble.sample, _Frame.partitions
dougbrn 78cafec
add tests
dougbrn 98b9cfc
add sampling and inspection docs
dougbrn c8b6b80
black run on ensemble_frame.py
dougbrn 3652085
missing noqa flag
dougbrn 3aa7778
black 24.1.1 run on ensemble_readers.py
dougbrn 5458af9
sample -> sample_objects; remove overwrite kwarg
dougbrn 2f8cb16
sample -> sample_objects; remove overwrite kwarg
dougbrn a1c764b
remove overwrite from docs
dougbrn 23e692f
turn off client cleanup in multi-ensemble -> 1 client case
dougbrn 3f35e03
add no client case
dougbrn 9945c81
update docstring
dougbrn bae58dc
update docstring
dougbrn fa40ea0
docstring updates; EnsembleFrame.sample
dougbrn fe82855
sample_objects -> sample
dougbrn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from .column_mapper import ColumnMapper # noqa | ||
from .utils import IndexCallable # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class IndexCallable: | ||
"""Provide getitem syntax for functions | ||
|
||
>>> def inc(x): | ||
... return x + 1 | ||
|
||
>>> I = IndexCallable(inc) | ||
>>> I[3] | ||
4 | ||
""" | ||
|
||
__slots__ = ("fn", "dirty", "ensemble") | ||
|
||
def __init__(self, fn, dirty, ensemble): | ||
self.fn = fn | ||
self.dirty = dirty # propagate metadata | ||
self.ensemble = ensemble # propagate ensemble metadata | ||
|
||
def __getitem__(self, key): | ||
result = self.fn(key) | ||
result.dirty = self.dirty # propagate metadata | ||
result.ensemble = self.ensemble # propagate ensemble metadata | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel there is a path for some ugly answers to this (implement our own client manager with reference counting, each ensemble keeps track of its parents/children in a tree-like structure that gets updated on-exit, etc) but not sure we need to solve this now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, agree that this is something to keep an eye on, but feels out of scope for this PR, I'll make an issue