use of org.apache.ignite.ml.tree.DecisionTreeNode in project ignite by apache.
the class XGModelVisitor method visitXgModel.
/**
* {@inheritDoc}
*/
@Override
public XGModelComposition visitXgModel(XGBoostModelParser.XgModelContext ctx) {
List<DecisionTreeNode> trees = new ArrayList<>();
Set<String> featureNames = new HashSet<>();
for (XGBoostModelParser.XgTreeContext treeCtx : ctx.xgTree()) featureNames.addAll(treeDictionaryVisitor.visitXgTree(treeCtx));
Map<String, Integer> dict = buildDictionary(featureNames);
XGTreeVisitor treeVisitor = new XGTreeVisitor(dict);
for (XGBoostModelParser.XgTreeContext treeCtx : ctx.xgTree()) {
DecisionTreeNode treeNode = treeVisitor.visitXgTree(treeCtx);
trees.add(treeNode);
}
return new XGModelComposition(dict, trees);
}
Aggregations