forked from scikit-learn/scikit-learn
-
Notifications
You must be signed in to change notification settings - Fork 7
Scarliles/honesty #69
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
Draft
SamuelCarliles3
wants to merge
85
commits into
neurodata:submodulev3
Choose a base branch
from
ssec-jhu:scarliles/honesty
base: submodulev3
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 62 commits
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
8c09f7f
init split condition injection
SamuelCarliles3 ecfc9b1
wip
SamuelCarliles3 0c3d5c0
wip
SamuelCarliles3 5fd12a2
wip
SamuelCarliles3 b593ee0
injection progress
SamuelCarliles3 180fac3
injection progress
SamuelCarliles3 c207c3e
split injection refactoring
SamuelCarliles3 7cc71c1
added condition parameter passthrough prototype
SamuelCarliles3 2470d49
some tidying
SamuelCarliles3 ee3399f
more tidying
SamuelCarliles3 a079e4f
splitter injection refactoring
SamuelCarliles3 5397b66
cython injection due diligence, converted min_sample and monotonic_cs…
SamuelCarliles3 44f1d57
tree tests pass huzzah!
SamuelCarliles3 4f19d53
added some splitconditions to header
SamuelCarliles3 cb71be0
commented out some sample code that was substantially increasing peak…
SamuelCarliles3 e34be5c
added vector resize
SamuelCarliles3 aac802e
wip
SamuelCarliles3 c12f2fd
Merge branch 'submodulev3' into scarliles/splitter-injection-redux
SamuelCarliles3 a7f5e92
settling injection memory management for now
SamuelCarliles3 7a70a0b
added regression forest benchmark
SamuelCarliles3 d9ad68a
Merge pull request #2 from ssec-jhu/scarliles/regression-benchmark
SamuelCarliles3 893d588
ran black for linting check
SamuelCarliles3 548493c
Merge branch 'submodulev3' of github.com:ssec-jhu/scikit-learn into s…
SamuelCarliles3 e4b53ff
Merge branch 'submodulev3' into scarliles/regression-benchmark
SamuelCarliles3 089d901
Merge branch 'neurodata:submodulev3' into submodulev3
SamuelCarliles3 3ba5f74
Merge branch 'submodulev3' of github.com:ssec-jhu/scikit-learn into s…
SamuelCarliles3 cf285c1
Merge branch 'scarliles/splitter-injection-redux' into scarliles/regr…
SamuelCarliles3 ffc6328
Merge pull request #3 from ssec-jhu/scarliles/regression-benchmark
SamuelCarliles3 87c90fd
initial pass at refactoring DepthFirstTreeBuilder.build
SamuelCarliles3 51da586
some renaming to make closure pattern more obvious
SamuelCarliles3 6c117a2
added SplitRecordFactory
SamuelCarliles3 c7b675b
Merge branch 'scarliles/update-node-refactor2' into scarliles/update-…
SamuelCarliles3 9e7b131
SplitRecordFactory progress
SamuelCarliles3 a017669
build loop refactor
SamuelCarliles3 4325b0a
add_or_update tweak
SamuelCarliles3 78c3a1b
reverted to back out build body refactor
SamuelCarliles3 b8cc636
refactor baby step
SamuelCarliles3 f225658
update node refactor more baby steps
SamuelCarliles3 bc17634
wip
SamuelCarliles3 c949182
added EventBroker class
SamuelCarliles3 247c4fc
added initial event firing to node_split_best
SamuelCarliles3 71da148
removed some old commented out code
SamuelCarliles3 a1fa950
honesty wip
SamuelCarliles3 ff0dfed
honesty wip
SamuelCarliles3 db4c947
honesty wip
SamuelCarliles3 2e87134
honesty wip
SamuelCarliles3 03c95d9
honesty wip
SamuelCarliles3 69fc530
honesty wip
SamuelCarliles3 61dfd0f
honesty wip
SamuelCarliles3 29a52be
Merge remote-tracking branch 'neurodata/submodulev3' into submodulev3
SamuelCarliles3 cf52ff5
broke sort functions, partitioners out of _splitter.pyx
SamuelCarliles3 8e433a6
refactored partitioner
SamuelCarliles3 09a8ec5
fixed some unintended commented out lines in SparsePartitioner
SamuelCarliles3 6bb7a33
Merge branch 'scarliles/defuse-partitioner' into scarliles/honesty
SamuelCarliles3 a2030a8
importing _honest_tree from treeple
SamuelCarliles3 64688e5
honesty wip
SamuelCarliles3 febf5e9
honesty wip
SamuelCarliles3 5e7d07d
honesty wip
SamuelCarliles3 2c4e992
honesty wip
SamuelCarliles3 2346e4d
honesty wip
SamuelCarliles3 551fcf1
honesty wip
SamuelCarliles3 f1fb747
honesty wip
SamuelCarliles3 2f2d15a
honest partition testing wip
SamuelCarliles3 cd79492
honest leaf validity test working
SamuelCarliles3 53cf65c
honest prediction wip
SamuelCarliles3 a9e065b
honest prediction wip
SamuelCarliles3 80c391d
honest prediction passing tests
SamuelCarliles3 9b5651e
hacked in working honest predict_proba, progress on honest regression
SamuelCarliles3 cbb23ee
first draft honest forest passing tests
SamuelCarliles3 c565d65
honesty wip
SamuelCarliles3 2316e4c
treeple-compatibility tweaks
SamuelCarliles3 71cacf3
might testing wip
SamuelCarliles3 6ea50cc
honest forest fixes, honest tree tests
SamuelCarliles3 492ddad
honest forest test added
SamuelCarliles3 92156cf
documented method and reasoning for Partitioner "defusing"
SamuelCarliles3 5291fb1
documented event broker
SamuelCarliles3 f655401
commented changes to splitter
SamuelCarliles3 877a822
commented changes to tree
SamuelCarliles3 3b16b8f
commented honesty module
SamuelCarliles3 5af6c0b
commented honest tree
SamuelCarliles3 d75a79b
commented classes.py
SamuelCarliles3 bdb4ee1
fixed dependency in honest tree tests
SamuelCarliles3 bd1dd04
Merge branch 'neurodata:submodulev3' into submodulev3
SamuelCarliles3 35432ee
merged back from submodulev3, overrode Partitioner and Splitter changes
SamuelCarliles3 7059bf7
commented out some flaky tests in tree which now fail. correct covera…
SamuelCarliles3 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 hidden or 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 hidden or 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 hidden or 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,32 @@ | ||
# Authors: Samuel Carliles <scarlil1@jhu.edu> | ||
# | ||
# License: BSD 3 clause | ||
|
||
# See _events.pyx for details. | ||
|
||
from libcpp.vector cimport vector | ||
from ..utils._typedefs cimport float32_t, float64_t, intp_t, int32_t, uint32_t | ||
|
||
ctypedef int EventType | ||
ctypedef void* EventHandlerEnv | ||
ctypedef void* EventData | ||
ctypedef bint (*EventHandlerFunction)( | ||
EventType event_type, | ||
EventHandlerEnv handler_env, | ||
EventData event_data | ||
) noexcept nogil | ||
|
||
cdef struct EventHandlerClosure: | ||
EventHandlerFunction f | ||
EventHandlerEnv e | ||
|
||
cdef class EventHandler: | ||
cdef public int[:] event_types | ||
cdef EventHandlerClosure c | ||
|
||
cdef class NullHandler(EventHandler): | ||
pass | ||
|
||
cdef class EventBroker: | ||
cdef vector[vector[EventHandlerClosure]] listeners # listeners acts as a map from EventType to corresponding event handlers | ||
cdef bint fire_event(self, EventType event_type, EventData event_data) noexcept nogil |
This file contains hidden or 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,61 @@ | ||
|
||
# Authors: Samuel Carliles <scarlil1@jhu.edu> | ||
# | ||
# License: BSD 3 clause | ||
|
||
|
||
cdef class EventBroker: | ||
def __cinit__(self, listeners: [EventHandler], event_types: [EventType]): | ||
""" | ||
Parameters: | ||
- listeners ([EventHandler]) | ||
- event_types ([EventType]): a list of EventTypes that may be fired by this EventBroker | ||
|
||
Notes: | ||
- Don't mix event types in a single EventBroker instance, | ||
i.e. don't use the same EventBroker for brokering NodeSplitEvent that you use | ||
for brokering TreeBuildEvent, etc | ||
""" | ||
self.listeners.resize(max(event_types) + 1) | ||
|
||
if(listeners is None): | ||
for e in range(max(event_types) + 1): | ||
self.listeners[e].resize(0) | ||
else: | ||
self.add_listeners(listeners, event_types) | ||
|
||
def add_listeners(self, listeners: [EventHandler], event_types: [EventType]): | ||
cdef int e, i, j, offset, mx, ct | ||
cdef list l | ||
|
||
# listeners is a vector of vectors which we index using EventType, | ||
# so if event_types contains any EventType for which we don't already have a vector, | ||
# its integer value will be larger than our current size + 1 | ||
mx = max(event_types) | ||
offset = self.listeners.size() | ||
if mx > offset + 1: | ||
self.listeners.resize(mx + 1) | ||
|
||
if(listeners is not None): | ||
for e in event_types: | ||
# find indices for all listeners to event type e | ||
l = [j for j, _l in enumerate(listeners) if e in (<EventHandler>_l).event_types] | ||
offset = self.listeners[e].size() | ||
ct = len(l) | ||
self.listeners[e].resize(offset + ct) | ||
for i in range(ct): | ||
j = l[i] | ||
self.listeners[e][offset + i] = (<EventHandler>listeners[j]).c | ||
|
||
cdef bint fire_event(self, EventType event_type, EventData event_data) noexcept nogil: | ||
cdef bint result = True | ||
|
||
#with gil: | ||
# print(f"firing event {event_type}") | ||
# print(f"listeners.size = {self.listeners.size()}") | ||
|
||
if event_type < self.listeners.size(): | ||
for l in self.listeners[event_type]: | ||
result = result and l.f(event_type, l.e, event_data) | ||
|
||
return result |
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.
Uh oh!
There was an error while loading. Please reload this page.