Module Hub Beta
ML.FOREST.ADDkey tree path ((NUMERIC|CATEGORIC) attr val | LEAF val) [...]
This commands adds one or more nodes to the tree in the forest that’s stored under key. Trees are identified by numeric ids,
treeid, that must begin at 0 and incremented by exactly 1 for each new tree.
Each of the nodes is described by its path and definition. The
path argument is the path from the tree’s root to the node. A valid path always starts with the period character (
.), which denotes the root. Optionally, the root may be followed by left or right branches , denoted by the characters
r, respectively. For example, the path “.lr” refers to the right child of the root’s left child.
A node in the decision tree can either be a splitter or a terminal leaf. Splitter nodes are either numerical or categorical, and are added using the
CATEGORIC keywords. Splitter nodes also require specifying the examined attribute (
attr) as well as the value (
val) used in the comparison made during the branching decision.
val is expected to be a double-precision floating point value for numerical splitters, and a string for categorical splitter nodes.
The leaves are created with the
LEAF keyword and only require specifying their double-precision floating point value (
redis> ML.FOREST.ADD myforst 0 . NUMERIC 1 0.1 .l LEAF 1 .r LEAF 0
redis> ML.FOREST.ADD myforst 1 . NUMERIC 1 0.1 .l LEAF 1 .r LEAF 0
redis> ML.FOREST.ADD myforst 2 . NUMERIC 1 0.1 .l LEAF 0 .r LEAF 1
redis> ML.FOREST.RUN myforst 1:0.01 CLASSIFICATION
redis> ML.FOREST.RUN myforst 1:0.2 CLASSIFICATION