Search in sources :

Example 36 with DataColumnSpecFilterConfiguration

use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.

the class LogRegLearnerNodeDialogPane method saveSettingsTo.

/**
 * {@inheritDoc}
 */
@Override
protected void saveSettingsTo(final NodeSettingsWO s) throws InvalidSettingsException {
    final LogRegLearnerSettings settings = new LogRegLearnerSettings();
    final DataColumnSpecFilterConfiguration config = LogRegLearnerNodeModel.createDCSFilterConfiguration();
    m_filterPanel.saveConfiguration(config);
    settings.setIncludedColumns(config);
    settings.setTargetColumn(m_selectionPanel.getSelectedColumn());
    settings.setTargetReferenceCategory((DataCell) m_targetReferenceCategory.getSelectedItem());
    settings.setUseTargetDomainOrder(m_notSortTarget.isSelected());
    settings.setUseFeatureDomainOrder(m_notSortIncludes.isSelected());
    settings.setSolver((Solver) m_solverComboBox.getSelectedItem());
    settings.setMaxEpoch((int) m_maxEpochSpinner.getValue());
    settings.setPerformLazy(m_lazyCalculationCheckBox.isSelected());
    settings.setCalcCovMatrix(m_calcCovMatrixCheckBox.isSelected());
    try {
        String str = m_epsilonField.getText();
        double epsilon = Double.valueOf(str);
        settings.setEpsilon(epsilon);
    } catch (NumberFormatException nfe) {
        throw new InvalidSettingsException("Please provide a valid value for epsilon.");
    }
    settings.setLearningRateStrategy((LearningRateStrategies) m_learningRateStrategyComboBox.getSelectedItem());
    try {
        String str = m_initialLearningRateField.getText();
        double lr = Double.valueOf(str);
        settings.setInitialLearningRate(lr);
    } catch (NumberFormatException nfe) {
        throw new InvalidSettingsException("Please provide a valid value for the initial learning rate.");
    }
    settings.setPrior((Prior) m_priorComboBox.getSelectedItem());
    settings.setPriorVariance((double) m_priorVarianceSpinner.getValue());
    settings.setInMemory(m_inMemoryCheckBox.isSelected());
    Long seed;
    if (m_useSeedCheckBox.isSelected()) {
        final String seedText = m_seedField.getText();
        try {
            seed = Long.valueOf(seedText);
        } catch (Exception e) {
            throw new InvalidSettingsException("Unable to parse seed \"" + seedText + "\"", e);
        }
    } else {
        seed = null;
    }
    settings.setSeed(seed);
    settings.setChunkSize((int) m_chunkSizeSpinner.getValue());
    settings.validate();
    settings.saveSettings(s);
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) NotConfigurableException(org.knime.core.node.NotConfigurableException)

Example 37 with DataColumnSpecFilterConfiguration

use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.

the class SplitNodeDialog2 method saveSettingsTo.

/**
 * {@inheritDoc}
 */
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
    DataColumnSpecFilterConfiguration config = SplitNodeModel2.createColFilterConf();
    m_filterPanel.saveConfiguration(config);
    config.saveConfiguration(settings);
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration)

Example 38 with DataColumnSpecFilterConfiguration

use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.

the class SplitNodeDialog2 method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
    final DataTableSpec spec = specs[0];
    DataColumnSpecFilterConfiguration config = SplitNodeModel2.createColFilterConf();
    config.loadConfigurationInDialog(settings, spec);
    m_filterPanel.loadConfiguration(config, spec);
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration)

Example 39 with DataColumnSpecFilterConfiguration

use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.

the class PolyRegLearnerDialog method loadSettingsFrom.

/**
 * {@inheritDoc}
 */
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
    DataTableSpec dataTableSpec = (DataTableSpec) specs[0];
    try {
        m_settings.loadSettingsInDialog(settings, dataTableSpec);
    } catch (InvalidSettingsException ex) {
        LinkedHashSet<String> defSelected = new LinkedHashSet<String>();
        for (DataColumnSpec s : dataTableSpec) {
            if (s.getType().isCompatible(DoubleValue.class)) {
                defSelected.add(s.getName());
            }
        }
        NodeSettings fakeSettings = PolyRegLearnerSettings.createFakeSettings("column filter", defSelected.toArray(new String[0]), new String[0], false);
        DataColumnSpecFilterConfiguration conf = new DataColumnSpecFilterConfiguration("column filter");
        conf.loadConfigurationInDialog(fakeSettings, dataTableSpec);
        m_settings.getFilterConfiguration().loadConfigurationInDialog(fakeSettings, dataTableSpec);
    // for the rest: ignore it, defaults are used instead
    }
    m_targetColumn.update(dataTableSpec, m_settings.getTargetColumn());
    m_degree.getModel().setValue(m_settings.getDegree());
    m_viewRows.getModel().setValue(m_settings.getMaxRowsForView());
    m_colSelectionPanel.loadConfiguration(m_settings.getFilterConfiguration(), dataTableSpec);
    m_colSelectionPanel.resetHiding();
    m_colSelectionPanel.hideNames((DataColumnSpec) m_targetColumn.getSelectedItem());
    m_missingValueHandlingIgnore.setSelected(m_settings.getMissingValueHandling().equals(MissingValueHandling.ignore));
    m_missingValueHandlingFail.setSelected(m_settings.getMissingValueHandling().equals(MissingValueHandling.fail));
}
Also used : LinkedHashSet(java.util.LinkedHashSet) DataTableSpec(org.knime.core.data.DataTableSpec) NodeSettings(org.knime.core.node.NodeSettings) DataColumnSpec(org.knime.core.data.DataColumnSpec) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) DoubleValue(org.knime.core.data.DoubleValue) DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration)

Example 40 with DataColumnSpecFilterConfiguration

use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.

the class ColumnListLoopStartNodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    DataColumnSpecFilterConfiguration config = createDCSFilterConfiguration();
    config.loadConfigurationInModel(settings);
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration)

Aggregations

DataColumnSpecFilterConfiguration (org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration)75 DataTableSpec (org.knime.core.data.DataTableSpec)15 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)14 NotConfigurableException (org.knime.core.node.NotConfigurableException)9 ChangeEvent (javax.swing.event.ChangeEvent)4 ChangeListener (javax.swing.event.ChangeListener)4 DataColumnSpec (org.knime.core.data.DataColumnSpec)4 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)4 DatabaseConnectionSettings (org.knime.core.node.port.database.DatabaseConnectionSettings)4 EnforceOption (org.knime.core.node.util.filter.NameFilterConfiguration.EnforceOption)4 DatabaseConnectionPortObjectSpec (org.knime.core.node.port.database.DatabaseConnectionPortObjectSpec)2 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 Solver (org.knime.base.node.mine.regression.logistic.learner4.LogRegLearnerSettings.Solver)1 BinNaming (org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.BinNaming)1 EqualityMethod (org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.EqualityMethod)1 Method (org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.Method)1 DoubleValue (org.knime.core.data.DoubleValue)1 IntValue (org.knime.core.data.IntValue)1