use of org.knime.base.data.normalize.PMMLNormalizeTranslator in project knime-core by knime.
the class NormalizerPMMLApplyNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inData, final ExecutionContext exec) throws Exception {
PMMLPortObject model = (PMMLPortObject) inData[0];
BufferedDataTable table = (BufferedDataTable) inData[1];
PMMLNormalizeTranslator translator = new PMMLNormalizeTranslator();
translator.initializeFrom(model.getDerivedFields());
AffineTransConfiguration config = getAffineTrans(translator.getAffineTransConfig());
if (config.getNames().length == 0) {
throw new IllegalArgumentException("No normalization configuration " + "found.");
}
AffineTransTable t = new AffineTransTable(table, config);
BufferedDataTable bdt = exec.createBufferedDataTable(t, exec);
if (t.getErrorMessage() != null) {
setWarningMessage(t.getErrorMessage());
}
return new PortObject[] { model, bdt };
}
use of org.knime.base.data.normalize.PMMLNormalizeTranslator in project knime-core by knime.
the class AbstractNormalizerPMMLNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
CalculationResult result = calculate(inObjects, exec);
BufferedDataTable outTable = result.getDataTable();
// the optional PMML in port (can be null)
PMMLPortObject inPMMLPort = m_hasModelIn ? (PMMLPortObject) inObjects[1] : null;
PMMLNormalizeTranslator trans = new PMMLNormalizeTranslator(result.getConfig(), new DerivedFieldMapper(inPMMLPort));
DataTableSpec dataTableSpec = (DataTableSpec) inObjects[0].getSpec();
PMMLPortObjectSpecCreator creator = new PMMLPortObjectSpecCreator(inPMMLPort, dataTableSpec);
PMMLPortObject outPMMLPort = new PMMLPortObject(creator.createSpec(), inPMMLPort);
outPMMLPort.addGlobalTransformations(trans.exportToTransDict());
return new PortObject[] { outTable, outPMMLPort };
}
Aggregations