Search in sources :

Example 1 with DecisionTreeModel

use of org.apache.spark.ml.tree.DecisionTreeModel in project jpmml-sparkml by jpmml.

the class TreeModelUtil method encodeDecisionTreeEnsemble.

public static <M extends Model<M> & TreeEnsembleModel<T>, T extends Model<T> & DecisionTreeModel> List<TreeModel> encodeDecisionTreeEnsemble(M model, PredicateManager predicateManager, Schema schema) {
    Schema segmentSchema = schema.toAnonymousSchema();
    List<TreeModel> treeModels = new ArrayList<>();
    T[] trees = model.trees();
    for (T tree : trees) {
        TreeModel treeModel = encodeDecisionTree(tree, predicateManager, segmentSchema);
        treeModels.add(treeModel);
    }
    return treeModels;
}
Also used : TreeModel(org.dmg.pmml.tree.TreeModel) DecisionTreeModel(org.apache.spark.ml.tree.DecisionTreeModel) Schema(org.jpmml.converter.Schema) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 DecisionTreeModel (org.apache.spark.ml.tree.DecisionTreeModel)1 TreeModel (org.dmg.pmml.tree.TreeModel)1 Schema (org.jpmml.converter.Schema)1