use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class TreeOptionsPanel method newTargetSelected.
/**
*/
private void newTargetSelected() {
DataTableSpec filtered = m_attributePanel.getCurrentAttributeSpec();
String prevSelected = m_hardCodedRootColumnBox.getSelectedColumn();
try {
m_hardCodedRootColumnBox.update(filtered, prevSelected);
} catch (NotConfigurableException nfe) {
LOGGER.coding("Unable to update column list upon target " + "selection change", nfe);
}
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class RuleEngineNodeDialog method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
if (specs == null || specs.length == 0 || specs[0] == null || specs[0].getNumColumns() == 0) {
throw new NotConfigurableException("No columns available!");
}
m_ruleEditor.setText("");
m_spec = specs[0];
m_variableModel.clear();
for (DataColumnSpec s : getVariables()) {
m_variableModel.addElement(s);
}
m_operatorModel.clear();
for (String op : getOperators()) {
m_operatorModel.addElement(op);
}
RuleEngineSettings ruleSettings = new RuleEngineSettings();
ruleSettings.loadSettingsForDialog(settings);
String defaultLabel = ruleSettings.getDefaultLabel();
m_defaultLabelEditor.setText(defaultLabel);
m_defaultLabelIsColumn.setSelected(ruleSettings.getDefaultLabelIsColumn());
String newColName = ruleSettings.getNewColName();
m_newColumnName.setText(newColName);
m_ruleModel.clear();
for (String rs : ruleSettings.rules()) {
try {
Rule r = new Rule(rs, m_spec);
m_ruleModel.addElement(r);
} catch (ParseException e) {
LOGGER.warn("Rule '" + rs + "' removed, because of " + e.getMessage());
}
}
m_lastUsedTextfield = null;
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class LinRegLinePlotterProperties method update.
/**
* Updates the selection boxes with the new
* {@link org.knime.core.data.DataTableSpec} and selects the passed indices.
* Takes care, that the x column selection box only contains the columns
* used for model calculation. For this purpose the ItemListeners of this
* box are removed and afterwards added again in order to avoid event loops.
*
* @param spec the new data table spec.
* @param xPreSelect the x column index (-1 if unknown)
* @param yPreSelect the y column (-1 if unknown)
*/
@Override
public void update(final DataTableSpec spec, final int xPreSelect, final int yPreSelect) {
try {
m_xSelector.update(spec, spec.getColumnSpec(xPreSelect).getName(), true);
m_ySelector.update(spec, spec.getColumnSpec(yPreSelect).getName(), true);
// store the old selected one
Object oldSelected = m_xSelector.getSelectedItem();
// suppress events
ItemListener[] listeners = m_xSelector.getItemListeners();
for (ItemListener listener : listeners) {
m_xSelector.removeItemListener(listener);
}
if (m_includs != null) {
// cleanup -> remove all items and add only the included
m_xSelector.removeAllItems();
List<String> survivors = Arrays.asList(m_includs);
for (DataColumnSpec colSpec : spec) {
if (!colSpec.getName().equals(m_targetColumn) && survivors.contains(colSpec.getName())) {
m_xSelector.addItem(colSpec);
}
}
// restore the previously selected
m_xSelector.setSelectedItem(oldSelected);
for (ItemListener listener : listeners) {
m_xSelector.addItemListener(listener);
}
}
} catch (NotConfigurableException e) {
LOGGER.warn(e.getMessage(), e);
}
DataColumnSpec x = (DataColumnSpec) m_xSelector.getSelectedItem();
DataColumnSpec y = (DataColumnSpec) m_ySelector.getSelectedItem();
m_ySelector.setEnabled(false);
updateRangeSpinner(x, y);
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class PolyRegLineScatterPlotter method modelChanged.
/**
* This method must be called if the model has changed. It updates the
* plotter to show the new model's values.
*/
public void modelChanged() {
DataTable data = m_model.getDataArray(0);
m_viewData = m_model.getViewData();
if (data != null) {
final DataTableSpec origSpec = data.getDataTableSpec();
final MyProperties props = (MyProperties) getProperties();
DataColumnSpec[] colSpecs = new DataColumnSpec[origSpec.getNumColumns() - 1];
int i = 0;
for (DataColumnSpec cs : origSpec) {
if (!m_viewData.targetColumn.equals(cs.getName())) {
colSpecs[i++] = cs;
} else {
m_yColumnSpec = cs;
getYAxis().setCoordinate(Coordinate.createCoordinate(cs));
}
}
m_xColumnSpec = colSpecs[0];
getXAxis().setCoordinate(Coordinate.createCoordinate(colSpecs[0]));
m_filteredSpec = new DataTableSpec(colSpecs);
try {
props.m_xColumn.update(m_filteredSpec, colSpecs[0].getName());
} catch (NotConfigurableException ex) {
// cannot happen
assert false : ex.getMessage();
}
reset();
updatePaintModel();
}
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class GradientBoostingLearnerConfiguration method loadInDialog.
/**
* {@inheritDoc}
*/
@Override
public void loadInDialog(final NodeSettingsRO settings, final DataTableSpec inSpec) throws NotConfigurableException {
super.loadInDialog(settings, inSpec);
String colSamplingModeString = settings.getString(KEY_COLUMN_SAMPLING_MODE, null);
if (colSamplingModeString == null) {
try {
setColumnSamplingMode(ColumnSamplingMode.None);
} catch (InvalidSettingsException e) {
throw new NotConfigurableException("Loading column sampling mode failed", e);
}
}
setDataSelectionWithReplacement(settings.getBoolean(KEY_IS_DATA_SELECTION_WITH_REPLACEMENT, false));
try {
setMaxLevels(settings.getInt(KEY_MAX_LEVELS, 4));
} catch (InvalidSettingsException e) {
throw new NotConfigurableException("Loading the maximal tree depth failed.", e);
}
setUseDifferentAttributesAtEachNode(settings.getBoolean(KEY_IS_USE_DIFFERENT_ATTRIBUTES_AT_EACH_NODE, false));
m_learningRate = settings.getDouble(KEY_LEARNINGRATE, DEF_LEARNINGRATE);
m_alphaFraction = settings.getDouble(KEY_ALPHA_FRACTION, DEF_ALPHA_FRACTION);
}
Aggregations