Skip to content

Commit dd75811

Browse files
committed
support convert of String Leaf
1 parent fcad48c commit dd75811

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/DecisionTree.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ __precompile__()
22

33
module DecisionTree
44

5-
import Base: length, show, convert, promote_rule
5+
import Base: length, show, convert, promote_rule, zero
66
using DelimitedFiles
77
using LinearAlgebra
88
using Random
@@ -47,6 +47,7 @@ end
4747
is_leaf(l::Leaf) = true
4848
is_leaf(n::Node) = false
4949

50+
zero(String) = ""
5051
convert(::Type{Node{S, T}}, lf::Leaf{T}) where {S, T} = Node(0, zero(S), lf, Leaf(zero(T), [zero(T)]))
5152
promote_rule(::Type{Node{S, T}}, ::Type{Leaf{T}}) where {S, T} = Node{S, T}
5253
promote_rule(::Type{Leaf{T}}, ::Type{Node{S, T}}) where {S, T} = Node{S, T}

0 commit comments

Comments
 (0)