1 | <?php |
||
6 | class DecisionTreeLeaf |
||
7 | { |
||
8 | const OPERATOR_EQ = '='; |
||
9 | /** |
||
10 | * @var string |
||
11 | */ |
||
12 | public $value; |
||
13 | |||
14 | /** |
||
15 | * @var int |
||
16 | */ |
||
17 | public $columnIndex; |
||
18 | |||
19 | /** |
||
20 | * @var DecisionTreeLeaf |
||
21 | */ |
||
22 | public $leftLeaf = null; |
||
23 | |||
24 | /** |
||
25 | * @var DecisionTreeLeaf |
||
26 | */ |
||
27 | public $rightLeaf= null; |
||
28 | |||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | public $records = []; |
||
33 | |||
34 | /** |
||
35 | * Class value represented by the leaf, this value is non-empty |
||
36 | * only for terminal leaves |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | public $classValue = ''; |
||
41 | |||
42 | /** |
||
43 | * @var bool |
||
44 | */ |
||
45 | public $isTerminal = false; |
||
46 | |||
47 | /** |
||
48 | * @var float |
||
49 | */ |
||
50 | public $giniIndex = 0; |
||
51 | |||
52 | /** |
||
53 | * @var int |
||
54 | */ |
||
55 | public $level = 0; |
||
56 | |||
57 | /** |
||
58 | * @param array $record |
||
59 | * @return bool |
||
60 | */ |
||
61 | public function evaluate($record) |
||
73 | |||
74 | public function __toString() |
||
106 | } |
||
107 |
On one hand,
eval
might be exploited by malicious users if they somehow manage to inject dynamic content. On the other hand, with the emergence of faster PHP runtimes like the HHVM,eval
prevents some optimization that they perform.