-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added unique internal node ID's when plotting a decision tree.
- Loading branch information
1 parent
b766ed4
commit 39bdcdc
Showing
1 changed file
with
5 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -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 | ||
|
@@ -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. | ||
*) | ||
|
||
|
@@ -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]}}; | ||
|
||
|
||
|