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) };
}
Aggregations