Skip to content

Commit c65f43b

Browse files
committed
Adapt to new AbstractNode in AbstractTrees
1 parent 558beb2 commit c65f43b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/abstract_trees.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ in "Towards Data Science":
1515
["If things are not ready to use"](https://towardsdatascience.com/part-iii-if-things-are-not-ready-to-use-59d2db378bec)
1616
"""
1717

18-
using AbstractNode # temporary workaround until this type is available via `AbstractTrees.jl`
19-
20-
2118
"""
2219
InfoNode{S, T}
2320
InfoLeaf{T}
@@ -32,15 +29,17 @@ In analogy to the type definitions of `DecisionTree`, the generic type `S` is
3229
the type of the feature values used within a node as a threshold for the splits
3330
between its children and `T` is the type of the classes given (these might be ids or labels).
3431
"""
35-
struct InfoNode{S, T} <: AbstractNode
32+
struct InfoNode{S, T} <: AbstractTrees.AbstractNode{DecisionTree.Node{S,T}}
3633
node :: DecisionTree.Node{S, T}
3734
info :: NamedTuple
3835
end
36+
AbstractTrees.nodevalue(n::InfoNode) = n.node
3937

40-
struct InfoLeaf{T} <: AbstractNode
38+
struct InfoLeaf{T} <: AbstractTrees.AbstractNode{DecisionTree.Leaf{T}}
4139
leaf :: DecisionTree.Leaf{T}
4240
info :: NamedTuple
4341
end
42+
AbstractTrees.nodevalue(l::InfoLeaf) = l.leaf
4443

4544
"""
4645
wrap(node::DecisionTree.Node, info = NamedTuple())

0 commit comments

Comments
 (0)