Search in sources :

Example 1 with Target

use of org.dmg.pmml.TargetDocument.Target 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 Target

use of org.dmg.pmml.TargetDocument.Target in project knime-core by knime.

the class PMMLSVMTranslator method addTargets.

/**
 * Writes the PMML target attributes.
 *
 * @param svmModel the SVM model to add the targets to
 * @param classColName name of the class column.
 */
private void addTargets(final SupportVectorMachineModel svmModel, final String classColName) {
    Target target = svmModel.addNewTargets().addNewTarget();
    target.setField(classColName);
    target.setOptype(OPTYPE.CATEGORICAL);
    // add target values
    for (String tv : m_targetValues) {
        TargetValue targetValue = target.addNewTargetValue();
        targetValue.setValue(tv);
    }
}
Also used : Target(org.dmg.pmml.TargetDocument.Target) TargetValue(org.dmg.pmml.TargetValueDocument.TargetValue)

Example 3 with Target

use of org.dmg.pmml.TargetDocument.Target 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)3 Targets (org.dmg.pmml.TargetsDocument.Targets)2 Segmentation (org.dmg.pmml.SegmentationDocument.Segmentation)1 TargetValue (org.dmg.pmml.TargetValueDocument.TargetValue)1 GradientBoostedTreesModel (org.knime.base.node.mine.treeensemble2.model.GradientBoostedTreesModel)1 TreeModelRegression (org.knime.base.node.mine.treeensemble2.model.TreeModelRegression)1