Search in sources :

Example 1 with SotaPortObject

use of org.knime.base.node.mine.sota.SotaPortObject in project knime-core by knime.

the class SotaPredictorNodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected PortObject[] execute(final PortObject[] inData, final ExecutionContext exec) throws CanceledExecutionException, Exception {
    if (!(inData[1] instanceof BufferedDataTable)) {
        throw new IllegalArgumentException("Given inport object at " + "index 0 is not a BufferedDataTable!");
    } else if (!(inData[0] instanceof SotaPortObject)) {
        throw new IllegalArgumentException("Given inport object at " + "index 1 is not a SotaPortObject");
    }
    BufferedDataTable bdt = (BufferedDataTable) inData[1];
    SotaPortObject spo = (SotaPortObject) inData[0];
    exec.checkCanceled();
    // build data table to use
    int[] indicesOfIncludedCols = new int[bdt.getDataTableSpec().getNumColumns()];
    for (int i = 0; i < bdt.getDataTableSpec().getNumColumns(); i++) {
        indicesOfIncludedCols[i] = i;
    }
    exec.checkCanceled();
    ColumnRearranger cr = new ColumnRearranger(bdt.getDataTableSpec());
    final SotaPortObjectSpec sotaSpec = (SotaPortObjectSpec) spo.getSpec();
    cr.append(new SotaPredictorCellFactory(spo.getSotaRoot(), indicesOfIncludedCols, spo.getDistance(), m_appendProbs.getBooleanValue(), sotaSpec.getClassColumnSpec(), m_probSuffix.getStringValue(), createOutColSpecs(sotaSpec)));
    return new BufferedDataTable[] { exec.createColumnRearrangeTable(bdt, cr, exec) };
}
Also used : ColumnRearranger(org.knime.core.data.container.ColumnRearranger) SotaPortObject(org.knime.base.node.mine.sota.SotaPortObject) SotaPortObjectSpec(org.knime.base.node.mine.sota.SotaPortObjectSpec) BufferedDataTable(org.knime.core.node.BufferedDataTable)

Aggregations

SotaPortObject (org.knime.base.node.mine.sota.SotaPortObject)1 SotaPortObjectSpec (org.knime.base.node.mine.sota.SotaPortObjectSpec)1 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)1 BufferedDataTable (org.knime.core.node.BufferedDataTable)1