Search in sources :

Example 1 with NumericOutliersReviser

use of org.knime.base.algorithms.outlier.NumericOutliersReviser in project knime-core by knime.

the class NumericOutliersApplyNodeModel method createStreamableOperator.

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

        SummaryInternals m_summaryInternals;

        @Override
        public void runFinal(final PortInput[] inputs, final PortOutput[] outputs, final ExecutionContext exec) throws Exception {
            final NumericOutlierPortObject outlierPort = (NumericOutlierPortObject) ((PortObjectInput) inputs[0]).getPortObject();
            NumericOutliersReviser outlierReviser = outlierPort.getOutRevBuilder().build();
            outlierReviser.treatOutliers(exec, (RowInput) inputs[1], (RowOutput) outputs[0], outlierPort.getOutlierModel(((RowInput) inputs[1]).getDataTableSpec()));
            m_summaryInternals = outlierReviser.getSummaryInternals();
        }

        /**
         * {@inheritDoc}
         */
        @Override
        public StreamableOperatorInternals saveInternals() {
            return m_summaryInternals;
        }
    };
}
Also used : ExecutionContext(org.knime.core.node.ExecutionContext) NumericOutlierPortObject(org.knime.base.algorithms.outlier.NumericOutlierPortObject) SummaryInternals(org.knime.base.algorithms.outlier.NumericOutliersReviser.SummaryInternals) NumericOutliersReviser(org.knime.base.algorithms.outlier.NumericOutliersReviser) StreamableOperator(org.knime.core.node.streamable.StreamableOperator) RowInput(org.knime.core.node.streamable.RowInput)

Example 2 with NumericOutliersReviser

use of org.knime.base.algorithms.outlier.NumericOutliersReviser in project knime-core by knime.

the class NumericOutliersApplyNodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected PortObject[] execute(final PortObject[] inData, final ExecutionContext exec) throws Exception {
    final NumericOutlierPortObject outlierPort = (NumericOutlierPortObject) inData[0];
    final BufferedDataTable in = (BufferedDataTable) inData[1];
    NumericOutliersReviser outlierReviser = outlierPort.getOutRevBuilder().build();
    outlierReviser.addListener(this);
    final BufferedDataTable outTable = outlierReviser.treatOutliers(exec, in, outlierPort.getOutlierModel(in.getDataTableSpec()));
    return new PortObject[] { outTable, outlierReviser.getSummaryTable() };
}
Also used : NumericOutlierPortObject(org.knime.base.algorithms.outlier.NumericOutlierPortObject) NumericOutliersReviser(org.knime.base.algorithms.outlier.NumericOutliersReviser) BufferedDataTable(org.knime.core.node.BufferedDataTable) NumericOutlierPortObject(org.knime.base.algorithms.outlier.NumericOutlierPortObject) PortObject(org.knime.core.node.port.PortObject)

Aggregations

NumericOutlierPortObject (org.knime.base.algorithms.outlier.NumericOutlierPortObject)2 NumericOutliersReviser (org.knime.base.algorithms.outlier.NumericOutliersReviser)2 SummaryInternals (org.knime.base.algorithms.outlier.NumericOutliersReviser.SummaryInternals)1 BufferedDataTable (org.knime.core.node.BufferedDataTable)1 ExecutionContext (org.knime.core.node.ExecutionContext)1 PortObject (org.knime.core.node.port.PortObject)1 RowInput (org.knime.core.node.streamable.RowInput)1 StreamableOperator (org.knime.core.node.streamable.StreamableOperator)1