简体   繁体   中英

How do i Print the object value? (php)

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.

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"];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM