Search in sources :

Example 6 with SettingsModelDouble

use of org.knime.core.node.defaultnodesettings.SettingsModelDouble in project knime-core by knime.

the class MissingValueColumnFilterNodeModel method validateSettings.

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

Example 7 with SettingsModelDouble

use of org.knime.core.node.defaultnodesettings.SettingsModelDouble in project knime-core by knime.

the class TableToVariableNodeDialog method getReplaceDouble.

/**
 * @param policyModel The policy model.
 * @return the SM for the new Double Value.
 */
static final SettingsModelDouble getReplaceDouble(final SettingsModelString policyModel) {
    final SettingsModelDouble model = new SettingsModelDouble("CFG_Double", 0);
    ChangeListener listener = new PolicyChangeListener(policyModel, model);
    policyModel.addChangeListener(listener);
    listener.stateChanged(null);
    return model;
}
Also used : SettingsModelDouble(org.knime.core.node.defaultnodesettings.SettingsModelDouble) ChangeListener(javax.swing.event.ChangeListener)

Example 8 with SettingsModelDouble

use of org.knime.core.node.defaultnodesettings.SettingsModelDouble in project knime-core by knime.

the class SVMLearnerNodeModel method saveSettingsTo.

/**
 * {@inheritDoc}
 */
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) {
    settings.addString(CFG_KERNELTYPE, m_kernelType.toString());
    m_paramC.saveSettingsTo(settings);
    m_classcol.saveSettingsTo(settings);
    for (Map.Entry<KernelType, Vector<SettingsModelDouble>> entry : m_kernelParameters.entrySet()) {
        Vector<SettingsModelDouble> kernelsettings = entry.getValue();
        for (SettingsModelDouble smd : kernelsettings) {
            smd.saveSettingsTo(settings);
        }
    }
}
Also used : SettingsModelDouble(org.knime.core.node.defaultnodesettings.SettingsModelDouble) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) KernelType(org.knime.base.node.mine.svm.kernel.KernelFactory.KernelType) Vector(java.util.Vector) DoubleVector(org.knime.base.node.mine.svm.util.DoubleVector)

Example 9 with SettingsModelDouble

use of org.knime.core.node.defaultnodesettings.SettingsModelDouble in project knime-core by knime.

the class SVMLearnerNodeModel method validateSettings.

/**
 * {@inheritDoc}
 */
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
    if (settings.containsKey(CFG_KERNELTYPE)) {
        String tmpKernel = settings.getString(CFG_KERNELTYPE);
        boolean found = false;
        for (String kernel : KernelFactory.getKernelNames()) {
            if (tmpKernel.equals(kernel)) {
                found = true;
            }
        }
        if (!found) {
            throw new InvalidSettingsException("Unknown kernel type: " + tmpKernel);
        }
    }
    for (Map.Entry<KernelType, Vector<SettingsModelDouble>> entry : m_kernelParameters.entrySet()) {
        Vector<SettingsModelDouble> kernelsettings = entry.getValue();
        for (SettingsModelDouble smd : kernelsettings) {
            try {
                smd.validateSettings(settings);
            } catch (InvalidSettingsException ise) {
                // it's not bad if a parameter is missing. This may be
                // an old version, but inform the user.
                LOGGER.warn("Did not find " + smd.toString() + " in the" + " NodeSettings. Using default value instead.");
            }
        }
    }
    m_paramC.validateSettings(settings);
    m_classcol.validateSettings(settings);
}
Also used : InvalidSettingsException(org.knime.core.node.InvalidSettingsException) SettingsModelDouble(org.knime.core.node.defaultnodesettings.SettingsModelDouble) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) KernelType(org.knime.base.node.mine.svm.kernel.KernelFactory.KernelType) Vector(java.util.Vector) DoubleVector(org.knime.base.node.mine.svm.util.DoubleVector)

Aggregations

SettingsModelDouble (org.knime.core.node.defaultnodesettings.SettingsModelDouble)9 DoubleVector (org.knime.base.node.mine.svm.util.DoubleVector)5 LinkedHashMap (java.util.LinkedHashMap)4 Vector (java.util.Vector)4 KernelType (org.knime.base.node.mine.svm.kernel.KernelFactory.KernelType)4 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)3 Kernel (org.knime.base.node.mine.svm.kernel.Kernel)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 TimerTask (java.util.TimerTask)1 ExecutionException (java.util.concurrent.ExecutionException)1 Future (java.util.concurrent.Future)1 ChangeListener (javax.swing.event.ChangeListener)1 PMMLSVMTranslator (org.knime.base.node.mine.svm.PMMLSVMTranslator)1 Svm (org.knime.base.node.mine.svm.Svm)1 BinarySvmRunnable (org.knime.base.node.mine.svm.util.BinarySvmRunnable)1 DataRow (org.knime.core.data.DataRow)1