automl / automl/random_forest_run

Get all node values from all trees in rf

Open
#45 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
39
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Hi!
I'm working on a research experiment, which requires from me to get the "max possible value", that the regression forest of yours can predict at the moment.

I've been trying to get that value using python api. I use **RandomForestWithInstances** in python.
It seems, there is no way I can get something like "all nodes from all trees", other than serializing the RandomForest to string or to tex and reading it.


`model.rf.ascii_string_representation()` gives me something like that.

Click to expand string representation. . .

```
{
"value0": {
"value0": 10,
"value1": 9,
"value2": true,
"value3": false,
"value4": {
"value0": 5,
"value1": 20,
"value2": 3,
"value3": 2.0,
"value4": 3,
"value5": 1.0,
"value6": 1048576,
"value7": 1e-8,
"value8": 1000.0,
"value9": false
}
},
"value1": [
{
"value0": [
{
"value0": [],
"value1": [],
"value2": 0,
"value3": {
"value0": 1,
"value1": 2
},
"value4": {
"value0": 0.5555555555555556,
"value1": 0.4444444444444444
},
"value5": {
"value0": 4,
"value1": 0.41871805715741286,
"value2": {
"type": 0,
"data": 0
}
},
"value6": {
"value0": 0.0,
"value1": 0.0,
"value2": {
"value0": 0,
"value1": 0.0,
"value2": 0.0
}
}
},
// some more here ...
],
"value1": 2,
"value2": 1
}
],
"value2": 6,
"value3": [],
"value4": NaN,
"value5": [
3,
0,
0,
0,
0,
0
],
"value6": [
{
"value0": 3.0,
"value1": NaN
},
{
"value0": 0.0,
"value1": 1.0
},
{
"value0": 0.0,
"value1": 1.0
},
{
"value0": 0.0,
"value1": 1.0
},
{
"value0": 0.0,
"value1": 1.0
},
{
"value0": -Infinity,
"value1": Infinity
}
]
}
```

What this `value0` ... `value6` are supposed to mean? I'm totally confused.

I tried to examine the c++ code from this repository, but `InputArchive`, `JSONInputArchive`, and other weird template structures seem to complicated and messy for me at the moment.

As far as a understood, I need to get `std::vector the_nodes;` from the `k_ary_random_tree` somehow, and then get `rfr::util::weighted_running_statistics response_stat;` from each node (`k_ary_node`, I suppose).

Can you please help me with this issue?
It can become a contribution to the code base, if I could understand how things work here.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the Python RandomForestWithInstances entry point and trace model.rf.ascii_string_representation() into the C++ k_ary_random_tree and k_ary_node types; the issue also identifies InputArchive and JSONInputArchive as relevant serialization code. Done means providing a documented way through the Python API to access all tree nodes and their response statistics without parsing a serialized representation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
backend-api-design, machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.