Search in sources :

Example 1 with Targets

use of org.dmg.pmml.TargetsDocument.Targets in project knime-core by knime.

the class ClassificationGBTModelExporter method addTarget.

private void addTarget(final MiningModel miningModel) {
    Targets targets = miningModel.addNewTargets();
    Target target = targets.addNewTarget();
    target.setRescaleConstant(getGBTModel().getInitialValue());
    target.setField(getGBTModel().getMetaData().getTargetMetaData().getAttributeName());
}
Also used : Target(org.dmg.pmml.TargetDocument.Target) Targets(org.dmg.pmml.TargetsDocument.Targets)

Example 2 with Targets

use of org.dmg.pmml.TargetsDocument.Targets in project knime-core by knime.

the class RegressionGBTModelExporter method doWrite.

/**
 * {@inheritDoc}
 */
@Override
protected void doWrite(final MiningModel model) {
    // write the initial value
    Targets targets = model.addNewTargets();
    Target target = targets.addNewTarget();
    GradientBoostedTreesModel gbtModel = getGBTModel();
    target.setField(gbtModel.getMetaData().getTargetMetaData().getAttributeName());
    target.setRescaleConstant(gbtModel.getInitialValue());
    // write the model
    Segmentation segmentation = model.addNewSegmentation();
    List<TreeModelRegression> trees = IntStream.range(0, gbtModel.getNrModels()).mapToObj(gbtModel::getTreeModelRegression).collect(Collectors.toList());
    writeSumSegmentation(segmentation, trees, gbtModel.getCoeffientMaps());
}
Also used : Target(org.dmg.pmml.TargetDocument.Target) Segmentation(org.dmg.pmml.SegmentationDocument.Segmentation) Targets(org.dmg.pmml.TargetsDocument.Targets) GradientBoostedTreesModel(org.knime.base.node.mine.treeensemble2.model.GradientBoostedTreesModel) TreeModelRegression(org.knime.base.node.mine.treeensemble2.model.TreeModelRegression)

Aggregations

Target (org.dmg.pmml.TargetDocument.Target)2 Targets (org.dmg.pmml.TargetsDocument.Targets)2 Segmentation (org.dmg.pmml.SegmentationDocument.Segmentation)1 GradientBoostedTreesModel (org.knime.base.node.mine.treeensemble2.model.GradientBoostedTreesModel)1 TreeModelRegression (org.knime.base.node.mine.treeensemble2.model.TreeModelRegression)1