Search in sources :

Example 1 with RandomForestClassificationModel

use of org.apache.spark.ml.classification.RandomForestClassificationModel in project jpmml-sparkml by jpmml.

the class RandomForestClassificationModelConverter method encodeModel.

@Override
public MiningModel encodeModel(Schema schema) {
    RandomForestClassificationModel model = getTransformer();
    List<TreeModel> treeModels = TreeModelUtil.encodeDecisionTreeEnsemble(model, schema);
    MiningModel miningModel = new MiningModel(MiningFunction.CLASSIFICATION, ModelUtil.createMiningSchema(schema.getLabel())).setSegmentation(MiningModelUtil.createSegmentation(Segmentation.MultipleModelMethod.AVERAGE, treeModels));
    return miningModel;
}
Also used : TreeModel(org.dmg.pmml.tree.TreeModel) MiningModel(org.dmg.pmml.mining.MiningModel) RandomForestClassificationModel(org.apache.spark.ml.classification.RandomForestClassificationModel)

Aggregations

RandomForestClassificationModel (org.apache.spark.ml.classification.RandomForestClassificationModel)1 MiningModel (org.dmg.pmml.mining.MiningModel)1 TreeModel (org.dmg.pmml.tree.TreeModel)1