use of org.dmg.pmml.True in project jpmml-r by jpmml.
the class GBMConverter method encodeTreeModel.
private TreeModel encodeTreeModel(MiningFunction miningFunction, RGenericVector tree, RGenericVector c_splits, Schema schema) {
Node root = new Node().setId("1").setPredicate(new True());
encodeNode(root, 0, tree, c_splits, schema);
TreeModel treeModel = new TreeModel(miningFunction, ModelUtil.createMiningSchema(schema.getLabel()), root).setSplitCharacteristic(TreeModel.SplitCharacteristic.MULTI_SPLIT);
return treeModel;
}
use of org.dmg.pmml.True in project jpmml-r by jpmml.
the class IForestConverter method encodeTreeModel.
private TreeModel encodeTreeModel(RGenericVector trees, int index, Schema schema) {
RIntegerVector nrnodes = (RIntegerVector) trees.getValue("nrnodes");
RIntegerVector ntree = (RIntegerVector) trees.getValue("ntree");
RIntegerVector nodeStatus = (RIntegerVector) trees.getValue("nodeStatus");
RIntegerVector leftDaughter = (RIntegerVector) trees.getValue("lDaughter");
RIntegerVector rightDaughter = (RIntegerVector) trees.getValue("rDaughter");
RIntegerVector splitAtt = (RIntegerVector) trees.getValue("splitAtt");
RDoubleVector splitPoint = (RDoubleVector) trees.getValue("splitPoint");
RIntegerVector nSam = (RIntegerVector) trees.getValue("nSam");
int rows = nrnodes.asScalar();
int columns = ntree.asScalar();
Node root = new Node().setPredicate(new True());
encodeNode(root, 0, 0, FortranMatrixUtil.getColumn(nodeStatus.getValues(), rows, columns, index), FortranMatrixUtil.getColumn(nSam.getValues(), rows, columns, index), FortranMatrixUtil.getColumn(leftDaughter.getValues(), rows, columns, index), FortranMatrixUtil.getColumn(rightDaughter.getValues(), rows, columns, index), FortranMatrixUtil.getColumn(splitAtt.getValues(), rows, columns, index), FortranMatrixUtil.getColumn(splitPoint.getValues(), rows, columns, index), schema);
TreeModel treeModel = new TreeModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(schema.getLabel()), root).setSplitCharacteristic(TreeModel.SplitCharacteristic.BINARY_SPLIT);
return treeModel;
}
use of org.dmg.pmml.True in project jpmml-r by jpmml.
the class RangerConverter method encodeTreeModel.
private TreeModel encodeTreeModel(MiningFunction miningFunction, ScoreEncoder scoreEncoder, RGenericVector childNodeIDs, RNumberVector<?> splitVarIDs, RNumberVector<?> splitValues, RGenericVector terminalClassCounts, Schema schema) {
RNumberVector<?> leftChildIDs = (RNumberVector<?>) childNodeIDs.getValue(0);
RNumberVector<?> rightChildIDs = (RNumberVector<?>) childNodeIDs.getValue(1);
Node root = new Node().setPredicate(new True());
encodeNode(root, 0, scoreEncoder, leftChildIDs, rightChildIDs, splitVarIDs, splitValues, terminalClassCounts, schema);
TreeModel treeModel = new TreeModel(miningFunction, ModelUtil.createMiningSchema(schema.getLabel()), root).setSplitCharacteristic(TreeModel.SplitCharacteristic.BINARY_SPLIT);
return treeModel;
}
use of org.dmg.pmml.True in project jpmml-sparkml by jpmml.
the class TreeModelCompactor method addCategoricalField.
private True addCategoricalField(SimpleSetPredicate simpleSetPredicate) {
True truePredicate = new True();
this.categoricalFields.put(truePredicate, simpleSetPredicate.getField());
return truePredicate;
}
use of org.dmg.pmml.True in project pyramid by cheng-li.
the class RegressionTree method encodeTreeModel.
// ======================PMML===========================
// this part follows the design of jpmml package
public TreeModel encodeTreeModel(Schema schema) {
org.dmg.pmml.tree.Node root = new org.dmg.pmml.tree.Node().setPredicate(new True());
encodeNode(root, 0, schema);
TreeModel treeModel = new TreeModel(MiningFunction.REGRESSION, ModelUtil.createMiningSchema(schema.getLabel()), root).setSplitCharacteristic(TreeModel.SplitCharacteristic.BINARY_SPLIT).setMissingValueStrategy(TreeModel.MissingValueStrategy.NONE).setMathContext(MathContext.FLOAT);
return treeModel;
}
Aggregations