Search in sources :

Example 61 with TreeEnsembleLearnerConfiguration

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

the class RandomForestRegressionLearnerNodeDialogPane method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
    final DataTableSpec inSpec = specs[0];
    TreeEnsembleLearnerConfiguration cfg = new TreeEnsembleLearnerConfiguration(true);
    cfg.loadInDialog(settings, inSpec);
    m_optionsPanel.loadSettingsFrom(inSpec, cfg);
}
Also used : TreeEnsembleLearnerConfiguration(org.knime.base.node.mine.treeensemble2.node.learner.TreeEnsembleLearnerConfiguration) DataTableSpec(org.knime.core.data.DataTableSpec)

Example 62 with TreeEnsembleLearnerConfiguration

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

the class RandomForestClassificationLearnerNodeModel 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.treeensemble2.node.learner.TreeEnsembleLearnerConfiguration)

Example 63 with TreeEnsembleLearnerConfiguration

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

the class RegressionTreeLearnerNodeDialogPane method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
    final DataTableSpec inSpec = specs[0];
    TreeEnsembleLearnerConfiguration cfg = new TreeEnsembleLearnerConfiguration(true);
    cfg.loadInDialog(settings, inSpec);
    m_optionsPanel.loadSettingsFrom(inSpec, cfg);
}
Also used : TreeEnsembleLearnerConfiguration(org.knime.base.node.mine.treeensemble2.node.learner.TreeEnsembleLearnerConfiguration) DataTableSpec(org.knime.core.data.DataTableSpec)

Example 64 with TreeEnsembleLearnerConfiguration

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

the class RegressionTreeLearnerNodeModel 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.treeensemble2.node.learner.TreeEnsembleLearnerConfiguration)

Example 65 with TreeEnsembleLearnerConfiguration

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

the class OptionsPanel method saveSettings.

/**
 * Save settings in config <b>cfg</b>
 *
 * @param cfg
 * @throws InvalidSettingsException
 */
public void saveSettings(final TreeEnsembleLearnerConfiguration cfg) throws InvalidSettingsException {
    cfg.setTargetColumn(m_targetColumnBox.getSelectedColumn());
    if (m_useFingerprintColumnRadio.isSelected()) {
        String fpColumn = m_fingerprintColumnBox.getSelectedColumn();
        cfg.setFingerprintColumn(fpColumn);
    // cfg.setIncludeAllColumns(false);
    } else {
        assert m_useOrdinaryColumnsRadio.isSelected();
        // boolean useAll = m_includeColumnsFilterPanel.isKeepAllSelected();
        // if (useAll) {
        // cfg.setIncludeAllColumns(true);
        // } else {
        // cfg.setIncludeAllColumns(false);
        // Set<String> incls = m_includeColumnsFilterPanel.getIncludedColumnSet();
        Set<String> incls = m_includeColumnsFilterPanel2.getIncludedNamesAsSet();
        if (incls.size() == 0) {
            throw new InvalidSettingsException("No learn columns selected");
        }
    // }
    }
    m_includeColumnsFilterPanel2.saveConfiguration(cfg.getColumnFilterConfig());
    int hiliteCount = m_enableHiliteChecker.isSelected() ? (Integer) m_hiliteCountSpinner.getValue() : -1;
    cfg.setNrHilitePatterns(hiliteCount);
    cfg.setIgnoreColumnsWithoutDomain(m_ignoreColumnsWithoutDomainChecker.isSelected());
    // cfg.setSaveTargetDistributionInNodes(false);
    // cfg.setIgnoreColumnsWithoutDomain(m_ignoreColumnsWithoutDomainChecker.isSelected());
    // cfg.setSaveTargetDistributionInNodes(m_saveTargetDistributionInNodesChecker.isSelected());
    // Tree Options
    cfg.setSplitCriterion(SplitCriterion.Gini);
    // cfg.setUseAverageSplitPoints(m_useAverageSplitPointsChecker.isSelected());
    cfg.setUseBinaryNominalSplits(m_useBinaryNominalSplitsCheckBox.isSelected());
    final MissingValueHandling missValHandling = (MissingValueHandling) m_missingValueHandlingComboBox.getSelectedItem();
    if (missValHandling == MissingValueHandling.Surrogate && !m_useBinaryNominalSplitsCheckBox.isSelected()) {
        throw new InvalidSettingsException("Surrogate missing value handling only works if binary nominal splits are enabled");
    }
    cfg.setMissingValueHandling(missValHandling);
    cfg.setUseAverageSplitPoints(true);
    int maxLevel = m_maxLevelChecker.isSelected() ? (Integer) m_maxLevelSpinner.getValue() : TreeEnsembleLearnerConfiguration.MAX_LEVEL_INFINITE;
    cfg.setMaxLevels(maxLevel);
    int minNodeSize = m_minNodeSizeChecker.isSelected() ? (Integer) m_minNodeSizeSpinner.getValue() : TreeEnsembleLearnerConfiguration.MIN_NODE_SIZE_UNDEFINED;
    int minChildNodeSize = m_minChildNodeSizeChecker.isSelected() ? (Integer) m_minChildNodeSizeSpinner.getValue() : TreeEnsembleLearnerConfiguration.MIN_CHILD_SIZE_UNDEFINED;
    cfg.setMinSizes(minNodeSize, minChildNodeSize);
    cfg.setHardCodedRootColumn(null);
    // Forest Options
    ColumnSamplingMode cf = ColumnSamplingMode.None;
    double columnFrac = 1.0;
    int columnAbsolute = TreeEnsembleLearnerConfiguration.DEF_COLUMN_ABSOLUTE;
    cfg.setColumnSamplingMode(cf);
    cfg.setColumnFractionLinearValue(columnFrac);
    cfg.setColumnAbsoluteValue(columnAbsolute);
    cfg.setUseDifferentAttributesAtEachNode(false);
}
Also used : InvalidSettingsException(org.knime.core.node.InvalidSettingsException) MissingValueHandling(org.knime.base.node.mine.treeensemble2.node.learner.TreeEnsembleLearnerConfiguration.MissingValueHandling) ColumnSamplingMode(org.knime.base.node.mine.treeensemble2.node.learner.TreeEnsembleLearnerConfiguration.ColumnSamplingMode)

Aggregations

TreeEnsembleLearnerConfiguration (org.knime.base.node.mine.treeensemble2.node.learner.TreeEnsembleLearnerConfiguration)62 Test (org.junit.Test)29 DataMemberships (org.knime.base.node.mine.treeensemble2.data.memberships.DataMemberships)27 RootDataMemberships (org.knime.base.node.mine.treeensemble2.data.memberships.RootDataMemberships)26 SplitCandidate (org.knime.base.node.mine.treeensemble2.learner.SplitCandidate)19 RandomData (org.apache.commons.math.random.RandomData)17 BitSet (java.util.BitSet)16 DefaultDataIndexManager (org.knime.base.node.mine.treeensemble2.data.memberships.DefaultDataIndexManager)15 NominalBinarySplitCandidate (org.knime.base.node.mine.treeensemble2.learner.NominalBinarySplitCandidate)15 IDataIndexManager (org.knime.base.node.mine.treeensemble2.data.memberships.IDataIndexManager)13 NominalMultiwaySplitCandidate (org.knime.base.node.mine.treeensemble2.learner.NominalMultiwaySplitCandidate)13 TreeData (org.knime.base.node.mine.treeensemble2.data.TreeData)10 TreeNodeNominalBinaryCondition (org.knime.base.node.mine.treeensemble2.model.TreeNodeNominalBinaryCondition)10 TestDataGenerator (org.knime.base.node.mine.treeensemble2.data.TestDataGenerator)9 TreeAttributeColumnData (org.knime.base.node.mine.treeensemble2.data.TreeAttributeColumnData)8 NumericSplitCandidate (org.knime.base.node.mine.treeensemble2.learner.NumericSplitCandidate)8 TreeNodeNumericCondition (org.knime.base.node.mine.treeensemble2.model.TreeNodeNumericCondition)7 NumericMissingSplitCandidate (org.knime.base.node.mine.treeensemble2.learner.NumericMissingSplitCandidate)6 TreeNodeNominalCondition (org.knime.base.node.mine.treeensemble2.model.TreeNodeNominalCondition)6 TreeTargetNominalColumnData (org.knime.base.node.mine.treeensemble2.data.TreeTargetNominalColumnData)5