Search in sources :

Example 21 with TreeModelRegression

use of org.knime.base.node.mine.treeensemble2.model.TreeModelRegression in project knime-core by knime.

the class RegressionTreeModelPortObject method createDecisionTreePMMLPortObject.

public PMMLPortObject createDecisionTreePMMLPortObject() {
    final RegressionTreeModel model = getModel();
    DataTableSpec attributeLearnSpec = model.getLearnAttributeSpec(m_spec.getLearnTableSpec());
    DataColumnSpec targetSpec = m_spec.getTargetColumn();
    PMMLPortObjectSpecCreator pmmlSpecCreator = new PMMLPortObjectSpecCreator(new DataTableSpec(attributeLearnSpec, new DataTableSpec(targetSpec)));
    try {
        pmmlSpecCreator.setLearningCols(attributeLearnSpec);
    } catch (InvalidSettingsException e) {
        // (as of KNIME v2.5.1)
        throw new IllegalStateException(e);
    }
    pmmlSpecCreator.setTargetCol(targetSpec);
    PMMLPortObjectSpec pmmlSpec = pmmlSpecCreator.createSpec();
    PMMLPortObject portObject = new PMMLPortObject(pmmlSpec);
    final TreeModelRegression tree = model.getTreeModel();
    portObject.addModelTranslater(new RegressionTreeModelPMMLTranslator(tree, model.getMetaData(), m_spec.getLearnTableSpec()));
    return portObject;
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) PMMLPortObjectSpec(org.knime.core.node.port.pmml.PMMLPortObjectSpec) DataColumnSpec(org.knime.core.data.DataColumnSpec) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) PMMLPortObject(org.knime.core.node.port.pmml.PMMLPortObject) PMMLPortObjectSpecCreator(org.knime.core.node.port.pmml.PMMLPortObjectSpecCreator) RegressionTreeModelPMMLTranslator(org.knime.base.node.mine.treeensemble2.model.pmml.RegressionTreeModelPMMLTranslator)

Aggregations

TreeModelRegression (org.knime.base.node.mine.treeensemble2.model.TreeModelRegression)13 TreeNodeSignature (org.knime.base.node.mine.treeensemble2.model.TreeNodeSignature)10 TreeNodeRegression (org.knime.base.node.mine.treeensemble2.model.TreeNodeRegression)6 Map (java.util.Map)5 TreeData (org.knime.base.node.mine.treeensemble2.data.TreeData)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 Segment (org.dmg.pmml.SegmentDocument.Segment)4 Segmentation (org.dmg.pmml.SegmentationDocument.Segmentation)4 PredictorRecord (org.knime.base.node.mine.treeensemble2.data.PredictorRecord)4 RandomData (org.apache.commons.math.random.RandomData)3 TreeTargetNumericColumnData (org.knime.base.node.mine.treeensemble2.data.TreeTargetNumericColumnData)3 IDataIndexManager (org.knime.base.node.mine.treeensemble2.data.memberships.IDataIndexManager)3 RegressionTreeModel (org.knime.base.node.mine.treeensemble2.model.RegressionTreeModel)3 DataRow (org.knime.core.data.DataRow)3 DataTableSpec (org.knime.core.data.DataTableSpec)3 IOException (java.io.IOException)2 List (java.util.List)2 Target (org.dmg.pmml.TargetDocument.Target)2 Targets (org.dmg.pmml.TargetsDocument.Targets)2