Search in sources :

Example 1 with RegressionPredictorCellFactory

use of org.knime.base.node.mine.regression.predict2.RegressionPredictorCellFactory in project knime-core by knime.

the class GeneralRegressionPredictorNodeModel method configure.

/**
 * {@inheritDoc}
 */
@Override
protected PortObjectSpec[] configure(final PortObjectSpec[] inSpecs) throws InvalidSettingsException {
    PMMLPortObjectSpec regModelSpec = (PMMLPortObjectSpec) inSpecs[0];
    DataTableSpec dataSpec = (DataTableSpec) inSpecs[1];
    if (dataSpec == null || regModelSpec == null) {
        throw new InvalidSettingsException("No input specification available");
    }
    RegressionPredictorSettings s = createRegressionPredictorSettings(regModelSpec, dataSpec);
    if (null != RegressionPredictorCellFactory.createColumnSpec(regModelSpec, dataSpec, s)) {
        ColumnRearranger c = new ColumnRearranger(dataSpec);
        c.append(new RegressionPredictorCellFactory(regModelSpec, dataSpec, s) {

            @Override
            public DataCell[] getCells(final DataRow row) {
                // not called during configure.
                return null;
            }
        });
        DataTableSpec outSpec = c.createSpec();
        return new DataTableSpec[] { outSpec };
    } else {
        return null;
    }
}
Also used : RegressionPredictorSettings(org.knime.base.node.mine.regression.predict2.RegressionPredictorSettings) PMMLPortObjectSpec(org.knime.core.node.port.pmml.PMMLPortObjectSpec) DataTableSpec(org.knime.core.data.DataTableSpec) ColumnRearranger(org.knime.core.data.container.ColumnRearranger) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) DataRow(org.knime.core.data.DataRow) RegressionPredictorCellFactory(org.knime.base.node.mine.regression.predict2.RegressionPredictorCellFactory)

Aggregations

RegressionPredictorCellFactory (org.knime.base.node.mine.regression.predict2.RegressionPredictorCellFactory)1 RegressionPredictorSettings (org.knime.base.node.mine.regression.predict2.RegressionPredictorSettings)1 DataRow (org.knime.core.data.DataRow)1 DataTableSpec (org.knime.core.data.DataTableSpec)1 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)1 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)1 PMMLPortObjectSpec (org.knime.core.node.port.pmml.PMMLPortObjectSpec)1