use of org.knime.core.node.port.pmml.PMMLPortObjectSpecCreator in project knime-core by knime.
the class RuleEngine2PortsNodeModel method computeFinalOutputSpecs.
/**
* {@inheritDoc}
*/
@Override
public PortObjectSpec[] computeFinalOutputSpecs(final StreamableOperatorInternals internals, final PortObjectSpec[] inSpecs) throws InvalidSettingsException {
final StreamInternalWithPortObject sipo = (StreamInternalWithPortObject) internals;
final DataTableSpec tableSpec = sipo.getTableSpec();
return new PortObjectSpec[] { tableSpec, sipo.getObject() != null ? new PMMLPortObjectSpecCreator(tableSpec).createSpec() : InactiveBranchPortObject.INSTANCE.getSpec() };
}
use of org.knime.core.node.port.pmml.PMMLPortObjectSpecCreator in project knime-core by knime.
the class DecisionTreeLearnerNodeModel method createPMMLPortObjectSpec.
private PMMLPortObjectSpec createPMMLPortObjectSpec(final PMMLPortObjectSpec modelSpec, final DataTableSpec spec) {
String targetCol = m_classifyColumn.getStringValue();
List<String> learnCols = new LinkedList<String>();
for (int i = 0; i < spec.getNumColumns(); i++) {
DataColumnSpec columnSpec = spec.getColumnSpec(i);
String col = columnSpec.getName();
if (!col.equals(targetCol) && (columnSpec.getType().isCompatible(DoubleValue.class) || columnSpec.getType().isCompatible(NominalValue.class) && (!m_skipColumns.getBooleanValue() || columnSpec.getDomain().hasValues()))) {
learnCols.add(spec.getColumnSpec(i).getName());
}
}
String[] usedCols = learnCols.toArray(new String[learnCols.size() + 1]);
usedCols[usedCols.length - 1] = targetCol;
PMMLPortObjectSpecCreator pmmlSpecCreator = new PMMLPortObjectSpecCreator(modelSpec, spec);
pmmlSpecCreator.setLearningColsNames(learnCols);
pmmlSpecCreator.setTargetColName(targetCol);
return pmmlSpecCreator.createSpec();
}
Aggregations