Search in sources :

Example 1 with PMMLPreprocPortObject

use of org.knime.core.node.port.pmml.preproc.PMMLPreprocPortObject in project knime-core by knime.

the class AutoBinnerApplyNodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
    PMMLPreprocPortObject pmmlPort = (PMMLPreprocPortObject) inObjects[0];
    BufferedDataTable inTable = (BufferedDataTable) inObjects[1];
    validatePMMLPort(pmmlPort);
    PMMLPreprocDiscretize op = (PMMLPreprocDiscretize) pmmlPort.getOperations().get(0);
    AutoBinnerApply applier = new AutoBinnerApply();
    BufferedDataTable binnedData = applier.execute(op, inTable, exec);
    return new PortObject[] { binnedData };
}
Also used : PMMLPreprocPortObject(org.knime.core.node.port.pmml.preproc.PMMLPreprocPortObject) BufferedDataTable(org.knime.core.node.BufferedDataTable) PMMLPreprocDiscretize(org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize) PMMLPreprocPortObject(org.knime.core.node.port.pmml.preproc.PMMLPreprocPortObject) PortObject(org.knime.core.node.port.PortObject)

Example 2 with PMMLPreprocPortObject

use of org.knime.core.node.port.pmml.preproc.PMMLPreprocPortObject in project knime-core by knime.

the class AutoBinnerApplyNodeModel method createStreamableOperator.

/**
 * {@inheritDoc}
 */
@Override
public StreamableOperator createStreamableOperator(final PartitionInfo partitionInfo, final PortObjectSpec[] inSpecs) throws InvalidSettingsException {
    return new StreamableOperator() {

        @Override
        public void runFinal(final PortInput[] inputs, final PortOutput[] outputs, final ExecutionContext exec) throws Exception {
            PMMLPreprocPortObject pmmlPort = (PMMLPreprocPortObject) ((PortObjectInput) inputs[0]).getPortObject();
            validatePMMLPort(pmmlPort);
            PMMLPreprocDiscretize op = (PMMLPreprocDiscretize) pmmlPort.getOperations().get(0);
            AutoBinnerApply applier = new AutoBinnerApply();
            ColumnRearranger core = applier.getRearranger(op, (DataTableSpec) inSpecs[1]);
            StreamableFunction func = core.createStreamableFunction(1, 0);
            func.runFinal(inputs, outputs, exec);
        }
    };
}
Also used : ExecutionContext(org.knime.core.node.ExecutionContext) ColumnRearranger(org.knime.core.data.container.ColumnRearranger) StreamableOperator(org.knime.core.node.streamable.StreamableOperator) PMMLPreprocPortObject(org.knime.core.node.port.pmml.preproc.PMMLPreprocPortObject) PMMLPreprocDiscretize(org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize) StreamableFunction(org.knime.core.node.streamable.StreamableFunction)

Aggregations

PMMLPreprocDiscretize (org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize)2 PMMLPreprocPortObject (org.knime.core.node.port.pmml.preproc.PMMLPreprocPortObject)2 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)1 BufferedDataTable (org.knime.core.node.BufferedDataTable)1 ExecutionContext (org.knime.core.node.ExecutionContext)1 PortObject (org.knime.core.node.port.PortObject)1 StreamableFunction (org.knime.core.node.streamable.StreamableFunction)1 StreamableOperator (org.knime.core.node.streamable.StreamableOperator)1