Search in sources :

Example 1 with NormalizerPortObject

use of org.knime.base.data.normalize.NormalizerPortObject in project knime-core by knime.

the class NormalizerNodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
    CalculationResult result = calculate(inObjects, exec);
    NormalizerPortObject p = new NormalizerPortObject(result.getSpec(), result.getConfig());
    return new PortObject[] { result.getDataTable(), p };
}
Also used : NormalizerPortObject(org.knime.base.data.normalize.NormalizerPortObject) PMMLPortObject(org.knime.core.node.port.pmml.PMMLPortObject) NormalizerPortObject(org.knime.base.data.normalize.NormalizerPortObject) PortObject(org.knime.core.node.port.PortObject)

Example 2 with NormalizerPortObject

use of org.knime.base.data.normalize.NormalizerPortObject in project knime-core by knime.

the class NormalizerApplyNodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected PortObject[] execute(final PortObject[] inData, final ExecutionContext exec) throws Exception {
    NormalizerPortObject model = (NormalizerPortObject) inData[0];
    BufferedDataTable table = (BufferedDataTable) inData[1];
    AffineTransTable t = new AffineTransTable(table, getAffineTrans(model.getConfiguration()));
    BufferedDataTable bdt = exec.createBufferedDataTable(t, exec);
    if (t.getErrorMessage() != null) {
        setWarningMessage(t.getErrorMessage());
    }
    return new BufferedDataTable[] { bdt };
}
Also used : NormalizerPortObject(org.knime.base.data.normalize.NormalizerPortObject) BufferedDataTable(org.knime.core.node.BufferedDataTable) AffineTransTable(org.knime.base.data.normalize.AffineTransTable)

Example 3 with NormalizerPortObject

use of org.knime.base.data.normalize.NormalizerPortObject in project knime-core by knime.

the class Normalizer3NodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
    CalculationResult result = calculate(inObjects, exec);
    NormalizerPortObject p = new NormalizerPortObject(result.getSpec(), result.getConfig());
    return new PortObject[] { result.getDataTable(), p };
}
Also used : NormalizerPortObject(org.knime.base.data.normalize.NormalizerPortObject) PMMLPortObject(org.knime.core.node.port.pmml.PMMLPortObject) NormalizerPortObject(org.knime.base.data.normalize.NormalizerPortObject) PortObject(org.knime.core.node.port.PortObject)

Example 4 with NormalizerPortObject

use of org.knime.base.data.normalize.NormalizerPortObject in project knime-core by knime.

the class Normalizer2NodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
    CalculationResult result = calculate(inObjects, exec);
    NormalizerPortObject p = new NormalizerPortObject(result.getSpec(), result.getConfig());
    return new PortObject[] { result.getDataTable(), p };
}
Also used : NormalizerPortObject(org.knime.base.data.normalize.NormalizerPortObject) PMMLPortObject(org.knime.core.node.port.pmml.PMMLPortObject) NormalizerPortObject(org.knime.base.data.normalize.NormalizerPortObject) PortObject(org.knime.core.node.port.PortObject)

Example 5 with NormalizerPortObject

use of org.knime.base.data.normalize.NormalizerPortObject in project knime-core by knime.

the class NormalizerApplyNodeModel method createStreamableOperator.

/**
 * {@inheritDoc}
 */
@Override
public StreamableOperator createStreamableOperator(final PartitionInfo partitionInfo, final PortObjectSpec[] inSpecs) throws InvalidSettingsException {
    if (getNrOutPorts() == 2) {
        // by default call the default implementation of this method
        return super.createStreamableOperator(partitionInfo, inSpecs);
    } else {
        return new StreamableOperator() {

            @Override
            public void runFinal(final PortInput[] inputs, final PortOutput[] outputs, final ExecutionContext exec) throws Exception {
                assert outputs.length == 1;
                NormalizerPortObject model = (NormalizerPortObject) ((PortObjectInput) inputs[0]).getPortObject();
                RowInput rowInput = (RowInput) inputs[1];
                AffineTransTable t = new AffineTransTable(rowInput, getAffineTrans(model.getConfiguration()));
                RowOutput rowOutput = (RowOutput) outputs[0];
                RowIterator it = t.iterator();
                while (it.hasNext()) {
                    rowOutput.push(it.next());
                }
                if (t.getErrorMessage() != null) {
                    // TODO collect error message from remote nodes if run distributed
                    setWarningMessage(t.getErrorMessage());
                }
                rowInput.close();
                rowOutput.close();
            }
        };
    }
}
Also used : NormalizerPortObject(org.knime.base.data.normalize.NormalizerPortObject) RowOutput(org.knime.core.node.streamable.RowOutput) ExecutionContext(org.knime.core.node.ExecutionContext) StreamableOperator(org.knime.core.node.streamable.StreamableOperator) RowIterator(org.knime.core.data.RowIterator) AffineTransTable(org.knime.base.data.normalize.AffineTransTable) RowInput(org.knime.core.node.streamable.RowInput)

Aggregations

NormalizerPortObject (org.knime.base.data.normalize.NormalizerPortObject)5 PortObject (org.knime.core.node.port.PortObject)3 PMMLPortObject (org.knime.core.node.port.pmml.PMMLPortObject)3 AffineTransTable (org.knime.base.data.normalize.AffineTransTable)2 RowIterator (org.knime.core.data.RowIterator)1 BufferedDataTable (org.knime.core.node.BufferedDataTable)1 ExecutionContext (org.knime.core.node.ExecutionContext)1 RowInput (org.knime.core.node.streamable.RowInput)1 RowOutput (org.knime.core.node.streamable.RowOutput)1 StreamableOperator (org.knime.core.node.streamable.StreamableOperator)1