Skip to content

Commit

Permalink
Added unique internal node ID's when plotting a decision tree.
Browse files Browse the repository at this point in the history
  • Loading branch information
antononcube committed Nov 18, 2015
1 parent b766ed4 commit 39bdcdc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions AVCDecisionTreeForest.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

(*
Decision tree and random forest implementations in Mathematica
Copyright (C) 2013 Anton Antonov
Copyright (C) 2013-2015 Anton Antonov
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -17,8 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
Written by Anton Antonov,
[email protected],
7320 Colbury Ave,
[email protected],
Windermere, Florida, USA.
*)

Expand Down Expand Up @@ -628,9 +627,10 @@ Mathematica is (C) Copyright 1988-2012 Wolfram Research, Inc.

Clear[DecisionTreeToRules]
DecisionTreeToRules[tree_] :=
Block[{},
Block[{dtree, k=0},
dtree = tree /. ({m_, v_, cInd_Integer, s_, n_} :> {m, v, cInd, s, n, "node "<>ToString[k++]});
MakeIDGenerator[];
TreeToRulesRecStep[tree]
TreeToRulesRecStep[dtree]
] /. {{r_Rule, edge_String} :> {r, Style[StandardForm[edge], Background -> White, FontSlant -> Plain]}};


Expand Down

0 comments on commit 39bdcdc

Please sign in to comment.