use of org.knime.base.node.mine.treeensemble2.model.RegressionTreeModelPortObjectSpec in project knime-core by knime.
the class RegressionTreePredictorNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
RegressionTreeModelPortObject model = (RegressionTreeModelPortObject) inObjects[0];
RegressionTreeModelPortObjectSpec modelSpec = model.getSpec();
BufferedDataTable data = (BufferedDataTable) inObjects[1];
DataTableSpec dataSpec = data.getDataTableSpec();
final RegressionTreePredictor pred = new RegressionTreePredictor(model.getModel(), modelSpec, dataSpec, m_configuration);
ColumnRearranger rearranger = pred.getPredictionRearranger();
BufferedDataTable outTable = exec.createColumnRearrangeTable(data, rearranger, exec);
return new BufferedDataTable[] { outTable };
}
use of org.knime.base.node.mine.treeensemble2.model.RegressionTreeModelPortObjectSpec in project knime-core by knime.
the class RegressionTreePredictorNodeModel method configure.
/**
* {@inheritDoc}
*/
@Override
protected PortObjectSpec[] configure(final PortObjectSpec[] inSpecs) throws InvalidSettingsException {
RegressionTreeModelPortObjectSpec modelSpec = (RegressionTreeModelPortObjectSpec) inSpecs[0];
String targetColName = modelSpec.getTargetColumn().getName();
if (m_configuration == null) {
m_configuration = RegressionTreePredictorConfiguration.createDefault(targetColName);
} else if (!m_configuration.isChangePredictionColumnName()) {
m_configuration.setPredictionColumnName(RegressionTreePredictorConfiguration.getPredictColumnName(targetColName));
}
DataTableSpec dataSpec = (DataTableSpec) inSpecs[1];
final RegressionTreePredictor pred = new RegressionTreePredictor(null, modelSpec, dataSpec, m_configuration);
ColumnRearranger rearranger = pred.getPredictionRearranger();
// rearranger may be null if confidence values are appended but the
// model does not have a list of possible target values
DataTableSpec outSpec = rearranger != null ? rearranger.createSpec() : null;
return new DataTableSpec[] { outSpec };
}
Aggregations