public class TreeAddAdditionalInfoFromArray extends Object implements Manipulator
treeNodeSelector
determines the nodes of the tree
which additional information is added to, which means that not necessarily
information has to be added to all nodes of the tree.
The static method addInfoToNodes()
allows to perform the same
operation on a single tree.Constructor and Description |
---|
TreeAddAdditionalInfoFromArray(TreeNodeSelector treeNodeSelector,
List<List<Double>> info,
String representation,
boolean applyToLeftExampleInPair)
Create a manipulator which adds an additional field to selected tree nodes
whose values are given by the List
info
passed as parameter to the constructor. |
TreeAddAdditionalInfoFromArray(TreeNodeSelector treeNodeSelector,
List<List<Double>> info,
String fieldName,
SelectRepresentationFromExample representationSelectorInExampleClass)
Create a manipulator which adds an additional field to selected tree nodes
whose values are determined by the parameter
info . |
TreeAddAdditionalInfoFromArray(TreeNodeSelector treeNodeSelector,
List<List<Double>> info,
String fieldName,
String representation)
Create a manipulator which adds an additional field to selected tree nodes
whose values are determined by the parameter
info . |
TreeAddAdditionalInfoFromArray(TreeNodeSelector treeNodeSelector,
List<List<Double>> info,
String fieldName,
String representation,
boolean applyToLeftExampleInPair)
Create a manipulator which adds an additional field to selected tree nodes
whose values are given by the List
info
passed as parameter to the constructor. |
Modifier and Type | Method and Description |
---|---|
static boolean |
addInfoToNodes(List<TreeNode> nodes,
List<Double> nodeInfo,
String fieldName)
A function for adding additional info to tree nodes.
|
String |
describe() |
void |
manipulate(Example example) |
public TreeAddAdditionalInfoFromArray(TreeNodeSelector treeNodeSelector, List<List<Double>> info, String fieldName, SelectRepresentationFromExample representationSelectorInExampleClass)
info
.treeNodeSelector
- determines the nodes of the tree which additional
information is added toinfo
- an array of Double containing the additional information to
be added. It must be ensured that the order of the elements in the array
is consistent with the order of the nodes as returned by treeNodeSelector
fieldName
- the name of the field in the nodes of trees which will
store the additional inforepresentationSelectorInExampleClass
- A class for retrieving a tree
from the Examplepublic TreeAddAdditionalInfoFromArray(TreeNodeSelector treeNodeSelector, List<List<Double>> info, String fieldName, String representation)
info
.treeNodeSelector
- determines the nodes of the tree which additional
information is added toinfo
- an array of Double containing the additional information to
be added. It must be ensured that the order of the elements in the array
is consistent with the order of the nodes as returned by treeNodeSelector
fieldName
- the name of the field in the nodes of trees which will
store the additional inforepresentation
- name of the representation of the trees in the Example
It assumes Example not to be an ExamplePairpublic TreeAddAdditionalInfoFromArray(TreeNodeSelector treeNodeSelector, List<List<Double>> info, String fieldName, String representation, boolean applyToLeftExampleInPair)
info
passed as parameter to the constructor.treeNodeSelector
- determines the nodes of the tree which additional
information is added toinfo
- an array of Double containing the additional information to
be added. It must be ensured that the order of the elements in the array
is consistent with the order of the nodes as returned by treeNodeSelector
fieldName
- the name of the field in which the additional information
will be stored.representation
- name of the representation of the trees in the Example
It assumes Example is an ExamplePairapplyToLeftExampleInPair
- a boolean specifying whether the
additional info is to be applied to the left element of the
ExamplePair (true) or to the right one (false)public TreeAddAdditionalInfoFromArray(TreeNodeSelector treeNodeSelector, List<List<Double>> info, String representation, boolean applyToLeftExampleInPair)
info
passed as parameter to the constructor. The data is added to a node field
with the default name "weight"treeNodeSelector
- determines the nodes of the tree which additional
information is added toinfo
- an array of Double containing the additional information to
be added. It must be ensured that the order of the elements in the array
is consistent with the order of the nodes as returned by treeNodeSelector
representation
- name of the representation of the trees in the Example
It assumes Example is an ExamplePairapplyToLeftExampleInPair
- a boolean specifying whether the
additional info is to be applied to the left element of the
ExamplePair (true) or to the right one (false)public String describe()
public void manipulate(Example example)
manipulate
in interface Manipulator
public static boolean addInfoToNodes(List<TreeNode> nodes, List<Double> nodeInfo, String fieldName)
nodes
- a TreeNode list representing the nodes which the info will
be added tonodeInfo
- a Double list with the info that will be attached to nodesfieldName
- the name of the field in the tree structureCopyright © 2018 Semantic Analytics Group @ Uniroma2. All rights reserved.