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

Causal trees bootstrapping and max_leaf_nodes fixes with minor update #583

Merged
merged 14 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion causalml/inference/tree/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .causal.causaltree import CausalTreeRegressor, CausalRandomForestRegressor
from .causal.causaltree import CausalTreeRegressor
from .causal.causalforest import CausalRandomForestRegressor
from .plot import uplift_tree_string, uplift_tree_plot, plot_dist_tree_leaves_values
from .uplift import DecisionTree, UpliftTreeClassifier, UpliftRandomForestClassifier
from .utils import (
Expand Down
27 changes: 27 additions & 0 deletions causalml/inference/tree/causal/_builder.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# cython: cdivision=True
# cython: boundscheck=False
# cython: wraparound=False
# cython: language_level=3
# cython: linetrace=True

from sklearn.tree._tree cimport Node, Tree, TreeBuilder
from sklearn.tree._tree cimport Splitter, SplitRecord
from sklearn.tree._utils cimport StackRecord, Stack
from sklearn.tree._utils cimport PriorityHeapRecord, PriorityHeap
from sklearn.tree._tree cimport SIZE_t, DOUBLE_t


cdef struct FrontierRecord:
# Record of information of a Node, the frontier for a split. Those records are
# maintained in a heap to access the Node with the best improvement in impurity,
# allowing growing trees greedily on this improvement.
SIZE_t node_id
SIZE_t start
SIZE_t end
SIZE_t pos
SIZE_t depth
bint is_leaf
double impurity
double impurity_left
double impurity_right
double improvement
Loading