0

I'm a newbie in PHP object. so I want to make random forest classification. I have a problem to print out the tree decision tree in my classification.

in this case my result classification :

[tree:protected] => Phpml\Classification\DecisionTree\DecisionTreeLeaf Object

                    (
                        [value] => <= 3.45
                        [numericValue] => 3.45
                        [operator] => <=
                        [columnIndex] => 1
                        [leftLeaf] => 
                        [rightLeaf] => 
                        [records] => Array
                            (
                                [0] => 0
                                [1] => 1
                                [2] => 2
                            )
                        [classValue] => late
                        [isTerminal] => 1
                        [isContinuous] => 1
                        [giniIndex] => 0.44444444444444
                        [level] => 0
                    )

how can I just print 3.45, the colomindex=1, late, the gini index, and the level? I want to use that value to build a decision tree.

Jayampathy Wijesena
  • 1,670
  • 1
  • 18
  • 26
  • Have a look in here. You should find your answers :-) [How to get protected property](https://stackoverflow.com/questions/20334355/how-to-get-protected-property-of-object-in-php) – Jakub Koudela Apr 02 '20 at 11:53

1 Answers1

0

I'm not sure if this answers your question but from my understanding, you would need to create an array like so: $tree = ["key" => "value"]; and then echo $tree["key"];

Silverback
  • 21
  • 8