Search in sources :

Example 11 with GradientBoostingPredictor

use of org.knime.base.node.mine.treeensemble2.node.gradientboosting.predictor.GradientBoostingPredictor in project knime-core by knime.

the class GradientBoostingPredictorCellFactory method createFactory.

public static GradientBoostingPredictorCellFactory createFactory(final GradientBoostingPredictor<GradientBoostedTreesModel> predictor) throws InvalidSettingsException {
    TreeEnsembleModelPortObjectSpec modelSpec = predictor.getModelSpec();
    DataTableSpec learnSpec = modelSpec.getLearnTableSpec();
    DataTableSpec testSpec = predictor.getDataSpec();
    UniqueNameGenerator nameGen = new UniqueNameGenerator(testSpec);
    DataColumnSpec newColSpec = nameGen.newColumn(predictor.getConfiguration().getPredictionColumnName(), DoubleCell.TYPE);
    return new GradientBoostingPredictorCellFactory(newColSpec, predictor.getModel(), learnSpec, modelSpec.calculateFilterIndices(testSpec));
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) DataColumnSpec(org.knime.core.data.DataColumnSpec) TreeEnsembleModelPortObjectSpec(org.knime.base.node.mine.treeensemble2.model.TreeEnsembleModelPortObjectSpec) UniqueNameGenerator(org.knime.core.util.UniqueNameGenerator)

Example 12 with GradientBoostingPredictor

use of org.knime.base.node.mine.treeensemble2.node.gradientboosting.predictor.GradientBoostingPredictor in project knime-core by knime.

the class GradientBoostingPredictorNodeModel method configure.

/**
 * {@inheritDoc}
 */
@Override
protected PortObjectSpec[] configure(final PortObjectSpec[] inSpecs) throws InvalidSettingsException {
    TreeEnsembleModelPortObjectSpec modelSpec = (TreeEnsembleModelPortObjectSpec) inSpecs[0];
    String targetColName = modelSpec.getTargetColumn().getName();
    if (m_configuration == null) {
        m_configuration = TreeEnsemblePredictorConfiguration.createDefault(false, targetColName);
    } else if (!m_configuration.isChangePredictionColumnName()) {
        m_configuration.setPredictionColumnName(TreeEnsemblePredictorConfiguration.getPredictColumnName(targetColName));
    }
    modelSpec.assertTargetTypeMatches(true);
    DataTableSpec dataSpec = (DataTableSpec) inSpecs[1];
    final GradientBoostingPredictor pred = new GradientBoostingPredictor(null, modelSpec, dataSpec, m_configuration);
    return new PortObjectSpec[] { pred.getPredictionRearranger().createSpec() };
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) TreeEnsembleModelPortObjectSpec(org.knime.base.node.mine.treeensemble2.model.TreeEnsembleModelPortObjectSpec) GradientBoostingPredictor(org.knime.base.node.mine.treeensemble2.node.gradientboosting.predictor.GradientBoostingPredictor) TreeEnsembleModelPortObjectSpec(org.knime.base.node.mine.treeensemble2.model.TreeEnsembleModelPortObjectSpec) PortObjectSpec(org.knime.core.node.port.PortObjectSpec)

Aggregations

DataTableSpec (org.knime.core.data.DataTableSpec)12 TreeEnsembleModelPortObjectSpec (org.knime.base.node.mine.treeensemble2.model.TreeEnsembleModelPortObjectSpec)10 GradientBoostingPredictor (org.knime.base.node.mine.treeensemble2.node.gradientboosting.predictor.GradientBoostingPredictor)9 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)8 GradientBoostingModelPortObject (org.knime.base.node.mine.treeensemble2.model.GradientBoostingModelPortObject)6 MultiClassGradientBoostedTreesModel (org.knime.base.node.mine.treeensemble2.model.MultiClassGradientBoostedTreesModel)5 GradientBoostedTreesModel (org.knime.base.node.mine.treeensemble2.model.GradientBoostedTreesModel)4 BufferedDataTable (org.knime.core.node.BufferedDataTable)3 ExecutionContext (org.knime.core.node.ExecutionContext)3 PortObjectSpec (org.knime.core.node.port.PortObjectSpec)3 StreamableFunction (org.knime.core.node.streamable.StreamableFunction)3 StreamableOperator (org.knime.core.node.streamable.StreamableOperator)3 DataColumnSpec (org.knime.core.data.DataColumnSpec)2 PMMLPortObject (org.knime.core.node.port.pmml.PMMLPortObject)2 UniqueNameGenerator (org.knime.core.util.UniqueNameGenerator)2 ArrayList (java.util.ArrayList)1 TreeEnsemblePredictorConfiguration (org.knime.base.node.mine.treeensemble2.node.predictor.TreeEnsemblePredictorConfiguration)1 DataCell (org.knime.core.data.DataCell)1 DataType (org.knime.core.data.DataType)1 StringValue (org.knime.core.data.StringValue)1