use of org.knime.core.data.DataTable in project knime-core by knime.
the class RuleEngine2PortsNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inData, final ExecutionContext exec) throws Exception {
BufferedDataTable data = (BufferedDataTable) inData[DATA_PORT];
m_rowCount = data.size();
try {
Pair<ColumnRearranger, PortObject> rearrangerPair = createColumnRearranger((DataTableSpec) inData[DATA_PORT].getSpec(), new DataTableRowInput((DataTable) inData[RULE_PORT]));
BufferedDataTable predictedTable = exec.createColumnRearrangeTable(data, rearrangerPair.getFirst(), exec);
PortObject second = rearrangerPair.getSecond();
if (m_settings.isPMMLRuleSet()) {
if (m_settings.isProvideStatistics()) {
PMMLPortObject po = (PMMLPortObject) rearrangerPair.getSecond();
PMMLPortObject pmmlPortObject = new PMMLPortObject(m_copy.getSpec(), po);
// Remove extra model.
pmmlPortObject.addModelTranslater(new PMMLTranslator() {
@Override
public void initializeFrom(final PMMLDocument pmmlDoc) {
}
@Override
public SchemaType exportTo(final PMMLDocument pmmlDoc, final PMMLPortObjectSpec spec) {
return null;
}
});
second = pmmlPortObject;
} else {
second = m_copy;
}
}
return new PortObject[] { predictedTable, second };
} finally {
m_rowCount = -1;
}
}
use of org.knime.core.data.DataTable in project knime-core by knime.
the class DataTableSpecView method dispose.
/**
* {@inheritDoc}
* @since 3.6
*/
@Override
public void dispose() {
TableContentModel contentModel = m_specView.getContentModel();
DataTable dataTable = contentModel.getDataTable();
contentModel.setDataTable(null);
if (dataTable instanceof ContainerTable) {
((ContainerTable) dataTable).clear();
}
}
use of org.knime.core.data.DataTable in project knime-core by knime.
the class RegressionTreeLearnerNodeView method newModel.
private void newModel() {
assert SwingUtilities.isEventDispatchThread();
final RegressionTreeLearnerNodeModel nodeModel = getNodeModel();
RegressionTreeModel model = nodeModel.getRegressionTreeModel();
DataTable hiliteRowSample = nodeModel.getHiliteRowSample();
UpdateTreeWorker updateWorker = new UpdateTreeWorker(hiliteRowSample, model);
UpdateTreeWorker old = m_updateWorkerRef.getAndSet(updateWorker);
if (old != null) {
old.cancel(true);
}
updateWorker.execute();
}
use of org.knime.core.data.DataTable in project knime-core by knime.
the class TreeEnsembleLearnerNodeView2 method newModel.
private void newModel(final int index) {
assert SwingUtilities.isEventDispatchThread();
final MODEL nodeModel = getNodeModel();
TreeEnsembleModel model = nodeModel.getEnsembleModel();
DataTable hiliteRowSample = nodeModel.getHiliteRowSample();
UpdateTreeWorker updateWorker = new UpdateTreeWorker(hiliteRowSample, model, index);
UpdateTreeWorker old = m_updateWorkerRef.getAndSet(updateWorker);
if (old != null) {
old.cancel(true);
}
updateWorker.execute();
}
use of org.knime.core.data.DataTable 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();
}
}
Aggregations