use of org.knime.core.node.port.pmml.PMMLTranslator in project knime-core by knime.
the class RuleEngine2PortsNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inData, final ExecutionContext exec) throws Exception {
BufferedDataTable data = (BufferedDataTable) inData[DATA_PORT];
m_rowCount = data.size();
try {
Pair<ColumnRearranger, PortObject> rearrangerPair = createColumnRearranger((DataTableSpec) inData[DATA_PORT].getSpec(), new DataTableRowInput((DataTable) inData[RULE_PORT]));
BufferedDataTable predictedTable = exec.createColumnRearrangeTable(data, rearrangerPair.getFirst(), exec);
PortObject second = rearrangerPair.getSecond();
if (m_settings.isPMMLRuleSet()) {
if (m_settings.isProvideStatistics()) {
PMMLPortObject po = (PMMLPortObject) rearrangerPair.getSecond();
PMMLPortObject pmmlPortObject = new PMMLPortObject(m_copy.getSpec(), po);
// Remove extra model.
pmmlPortObject.addModelTranslater(new PMMLTranslator() {
@Override
public void initializeFrom(final PMMLDocument pmmlDoc) {
}
@Override
public SchemaType exportTo(final PMMLDocument pmmlDoc, final PMMLPortObjectSpec spec) {
return null;
}
});
second = pmmlPortObject;
} else {
second = m_copy;
}
}
return new PortObject[] { predictedTable, second };
} finally {
m_rowCount = -1;
}
}
Aggregations