use of org.knime.core.node.defaultnodesettings.SettingsModelIntegerBounded in project knime-core by knime.
the class NaiveBayesLearnerNodeModel2 method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
final SettingsModelString colName = m_classifyColumnName.createCloneWithValidatedValue(settings);
if (colName == null || colName.getStringValue() == null || colName.getStringValue().trim().length() < 1) {
throw new InvalidSettingsException("No class column selected");
}
final SettingsModelIntegerBounded maxNoOfNomVals = m_maxNoOfNominalVals.createCloneWithValidatedValue(settings);
if (maxNoOfNomVals.getIntValue() < 0) {
throw new InvalidSettingsException("Maximum number of unique nominal values should be a positive number");
}
m_pmmlCompatible.validateSettings(settings);
m_threshold.validateSettings(settings);
}
use of org.knime.core.node.defaultnodesettings.SettingsModelIntegerBounded in project knime-core by knime.
the class CreateBitVectorNodeModel method createMeanPercentageModel.
/**
* @return the mean percentage model from 0 to 100.
*/
@SuppressWarnings("unused")
static SettingsModelInteger createMeanPercentageModel() {
final SettingsModelIntegerBounded model = new SettingsModelIntegerBounded("singleNumericMeanThreshold", 100, 0, Integer.MAX_VALUE);
// disable the model since we use threshold by default
model.setEnabled(DEFAULT_USE_MEAN && ColumnType.getDefault().equals(ColumnType.MULTI_NUMERICAL));
return model;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelIntegerBounded in project knime-core by knime.
the class RoundDoubleNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
m_filterDoubleColModel.validateSettings(settings);
m_numberPrecisionModel.validateSettings(settings);
m_appendColumnsModel.validateSettings(settings);
m_columnSuffixModel.validateSettings(settings);
m_roundingModeModel.validateSettings(settings);
try {
// added in 2.8
m_outputTypeModel.validateSettings(settings);
} catch (InvalidSettingsException ise) {
RoundDoubleNodeDialog.getOutputAsStringModel().validateSettings(settings);
}
m_numberModeModel.validateSettings(settings);
// additional sanity checks
StringBuffer errMsgBuffer = new StringBuffer();
boolean err = false;
// precision number has to be between 0 and inf
int precision = ((SettingsModelIntegerBounded) m_numberPrecisionModel.createCloneWithValidatedValue(settings)).getIntValue();
if (precision < MIN_PRECISION || precision > MAX_PRECISION) {
errMsgBuffer.append("Rounding precision has to be between " + MIN_PRECISION + " and " + MAX_PRECISION + "\n");
err = true;
}
// if rounded values have to be appended, check for valid column suffix
boolean append = ((SettingsModelBoolean) m_appendColumnsModel.createCloneWithValidatedValue(settings)).getBooleanValue();
if (append) {
String suffix = ((SettingsModelString) m_columnSuffixModel.createCloneWithValidatedValue(settings)).getStringValue();
if (suffix.length() <= 0) {
errMsgBuffer.append("Column suffix may not be empty if append " + "columns is set!\n");
err = true;
}
}
// rounding mode string needs to be a valid round mode
String roundingModeString = ((SettingsModelString) m_roundingModeModel.createCloneWithValidatedValue(settings)).getStringValue();
try {
RoundingMode.valueOf(roundingModeString);
} catch (Exception e) {
errMsgBuffer.append("Specified round mode is not valid!\n");
err = true;
}
// number mode string needs to be a valid number mode
String numberModeString = ((SettingsModelString) m_numberModeModel.createCloneWithValidatedValue(settings)).getStringValue();
try {
NumberMode.valueByDescription(numberModeString);
} catch (Exception e) {
errMsgBuffer.append("Specified number mode is not valid!\n");
err = true;
// throw exception when at least one settings is invalid
} finally {
if (err) {
throw new InvalidSettingsException(errMsgBuffer.toString());
}
}
}
use of org.knime.core.node.defaultnodesettings.SettingsModelIntegerBounded in project knime-core by knime.
the class DecisionTreeLearnerNodeDialog method createSettingsBinaryMaxNominalValues.
/**
* @return max number nominal values for complete subset calculation for
* binary nominal splits
*/
static SettingsModelIntegerBounded createSettingsBinaryMaxNominalValues() {
SettingsModelIntegerBounded model = new SettingsModelIntegerBounded(DecisionTreeLearnerNodeModel.KEY_BINARY_MAX_NUM_NOMINAL_VALUES, DecisionTreeLearnerNodeModel.DEFAULT_MAX_BIN_NOMINAL_SPLIT_COMPUTATION, 1, Integer.MAX_VALUE);
model.setEnabled(DecisionTreeLearnerNodeModel.DEFAULT_BINARY_NOMINAL_SPLIT_MODE);
return model;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelIntegerBounded in project knime-core by knime.
the class DecisionTreeLearnerNodeDialog2 method createSettingsBinaryMaxNominalValues.
/**
* @return max number nominal values for complete subset calculation for
* binary nominal splits
*/
static SettingsModelIntegerBounded createSettingsBinaryMaxNominalValues() {
SettingsModelIntegerBounded model = new SettingsModelIntegerBounded(DecisionTreeLearnerNodeModel2.KEY_BINARY_MAX_NUM_NOMINAL_VALUES, DecisionTreeLearnerNodeModel2.DEFAULT_MAX_BIN_NOMINAL_SPLIT_COMPUTATION, 1, Integer.MAX_VALUE);
model.setEnabled(DecisionTreeLearnerNodeModel2.DEFAULT_BINARY_NOMINAL_SPLIT_MODE);
return model;
}
Aggregations