Search in sources :

Example 6 with TreeEnsembleLearnerConfiguration

use of org.knime.base.node.mine.treeensemble.node.learner.TreeEnsembleLearnerConfiguration in project knime-core by knime.

the class TreeEnsembleClassificationLearnerNodeDialogPane method saveSettingsTo.

/**
 * {@inheritDoc}
 */
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
    TreeEnsembleLearnerConfiguration cfg = new TreeEnsembleLearnerConfiguration(false);
    m_attributeSelectionPanel.saveSettings(cfg);
    m_treeOptionsPanel.saveSettings(cfg);
    m_ensembleOptionsPanel.saveSettings(cfg);
    cfg.save(settings);
}
Also used : TreeEnsembleLearnerConfiguration(org.knime.base.node.mine.treeensemble.node.learner.TreeEnsembleLearnerConfiguration)

Example 7 with TreeEnsembleLearnerConfiguration

use of org.knime.base.node.mine.treeensemble.node.learner.TreeEnsembleLearnerConfiguration in project knime-core by knime.

the class TreeLearnerRegression method findBestSplitRegression.

private SplitCandidate findBestSplitRegression(final int currentDepth, final double[] rowSampleWeights, final TreeNodeSignature treeNodeSignature, final RegressionPriors targetPriors, final BitSet forbiddenColumnSet, final TreeNodeMembershipController membershipController) {
    final TreeData data = getData();
    final ColumnSampleStrategy colSamplingStrategy = getColSamplingStrategy();
    final TreeEnsembleLearnerConfiguration config = getConfig();
    final int maxLevels = config.getMaxLevels();
    if (maxLevels != TreeEnsembleLearnerConfiguration.MAX_LEVEL_INFINITE && currentDepth >= maxLevels) {
        return null;
    }
    final int minNodeSize = config.getMinNodeSize();
    if (minNodeSize != TreeEnsembleLearnerConfiguration.MIN_NODE_SIZE_UNDEFINED) {
        if (targetPriors.getNrRecords() < minNodeSize) {
            return null;
        }
    }
    final double priorSquaredDeviation = targetPriors.getSumSquaredDeviation();
    if (priorSquaredDeviation < TreeColumnData.EPSILON) {
        return null;
    }
    final TreeTargetNumericColumnData targetColumn = getTargetData();
    SplitCandidate splitCandidate = null;
    if (currentDepth == 0 && config.getHardCodedRootColumn() != null) {
        final TreeAttributeColumnData rootColumn = data.getColumn(config.getHardCodedRootColumn());
        return rootColumn.calcBestSplitRegression(membershipController, rowSampleWeights, targetPriors, targetColumn);
    } else {
        double bestGainValue = 0.0;
        final ColumnSample columnSample = colSamplingStrategy.getColumnSampleForTreeNode(treeNodeSignature);
        for (TreeAttributeColumnData col : columnSample) {
            if (forbiddenColumnSet.get(col.getMetaData().getAttributeIndex())) {
                continue;
            }
            SplitCandidate currentColSplit = col.calcBestSplitRegression(membershipController, rowSampleWeights, targetPriors, targetColumn);
            if (currentColSplit != null) {
                double gainValue = currentColSplit.getGainValue();
                if (gainValue > bestGainValue) {
                    bestGainValue = gainValue;
                    splitCandidate = currentColSplit;
                }
            }
        }
    }
    return splitCandidate;
}
Also used : TreeEnsembleLearnerConfiguration(org.knime.base.node.mine.treeensemble.node.learner.TreeEnsembleLearnerConfiguration) ColumnSampleStrategy(org.knime.base.node.mine.treeensemble.sample.column.ColumnSampleStrategy) TreeAttributeColumnData(org.knime.base.node.mine.treeensemble.data.TreeAttributeColumnData) ColumnSample(org.knime.base.node.mine.treeensemble.sample.column.ColumnSample) TreeTargetNumericColumnData(org.knime.base.node.mine.treeensemble.data.TreeTargetNumericColumnData) TreeData(org.knime.base.node.mine.treeensemble.data.TreeData)

Example 8 with TreeEnsembleLearnerConfiguration

use of org.knime.base.node.mine.treeensemble.node.learner.TreeEnsembleLearnerConfiguration in project knime-core by knime.

the class TreeEnsembleClassificationLearnerNodeModel method loadValidatedSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadValidatedSettingsFrom(final NodeSettingsRO settings) throws InvalidSettingsException {
    TreeEnsembleLearnerConfiguration config = new TreeEnsembleLearnerConfiguration(false);
    config.loadInModel(settings);
    m_configuration = config;
}
Also used : TreeEnsembleLearnerConfiguration(org.knime.base.node.mine.treeensemble.node.learner.TreeEnsembleLearnerConfiguration)

Example 9 with TreeEnsembleLearnerConfiguration

use of org.knime.base.node.mine.treeensemble.node.learner.TreeEnsembleLearnerConfiguration in project knime-core by knime.

the class TreeEnsembleRegressionLearnerNodeModel method loadValidatedSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadValidatedSettingsFrom(final NodeSettingsRO settings) throws InvalidSettingsException {
    TreeEnsembleLearnerConfiguration config = new TreeEnsembleLearnerConfiguration(true);
    config.loadInModel(settings);
    m_configuration = config;
}
Also used : TreeEnsembleLearnerConfiguration(org.knime.base.node.mine.treeensemble.node.learner.TreeEnsembleLearnerConfiguration)

Example 10 with TreeEnsembleLearnerConfiguration

use of org.knime.base.node.mine.treeensemble.node.learner.TreeEnsembleLearnerConfiguration in project knime-core by knime.

the class RandomForestRegressionLearnerNodeDialogPane method saveSettingsTo.

/**
 * {@inheritDoc}
 */
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
    TreeEnsembleLearnerConfiguration cfg = new TreeEnsembleLearnerConfiguration(true);
    m_optionsPanel.saveSettings(cfg);
    cfg.save(settings);
}
Also used : TreeEnsembleLearnerConfiguration(org.knime.base.node.mine.treeensemble.node.learner.TreeEnsembleLearnerConfiguration)

Aggregations

TreeEnsembleLearnerConfiguration (org.knime.base.node.mine.treeensemble.node.learner.TreeEnsembleLearnerConfiguration)22 TreeData (org.knime.base.node.mine.treeensemble.data.TreeData)6 DataTableSpec (org.knime.core.data.DataTableSpec)5 TreeAttributeColumnData (org.knime.base.node.mine.treeensemble.data.TreeAttributeColumnData)4 TreeNodeMembershipController (org.knime.base.node.mine.treeensemble.data.TreeNodeMembershipController)4 TreeTargetNominalColumnData (org.knime.base.node.mine.treeensemble.data.TreeTargetNominalColumnData)3 TreeTargetNumericColumnData (org.knime.base.node.mine.treeensemble.data.TreeTargetNumericColumnData)3 BitSet (java.util.BitSet)2 ClassificationPriors (org.knime.base.node.mine.treeensemble.data.ClassificationPriors)2 RegressionPriors (org.knime.base.node.mine.treeensemble.data.RegressionPriors)2 TreeNodeClassification (org.knime.base.node.mine.treeensemble.model.TreeNodeClassification)2 TreeNodeCondition (org.knime.base.node.mine.treeensemble.model.TreeNodeCondition)2 TreeNodeRegression (org.knime.base.node.mine.treeensemble.model.TreeNodeRegression)2 TreeNodeSignature (org.knime.base.node.mine.treeensemble.model.TreeNodeSignature)2 ColumnSample (org.knime.base.node.mine.treeensemble.sample.column.ColumnSample)2 ColumnSampleStrategy (org.knime.base.node.mine.treeensemble.sample.column.ColumnSampleStrategy)2 RowSample (org.knime.base.node.mine.treeensemble.sample.row.RowSample)2 AbstractTreeModel (org.knime.base.node.mine.treeensemble.model.AbstractTreeModel)1 TreeEnsembleModel (org.knime.base.node.mine.treeensemble.model.TreeEnsembleModel)1 TreeModelClassification (org.knime.base.node.mine.treeensemble.model.TreeModelClassification)1