use of org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize in project knime-core by knime.
the class AutoBinnerLearnNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
BufferedDataTable data = (BufferedDataTable) inObjects[0];
AutoBinner binner = new AutoBinner(m_settings);
BufferedDataTable inData = binner.calcDomainBoundsIfNeccessary(data, exec, Arrays.asList(m_settings.getTargetColumn()));
PMMLPreprocDiscretize op = binner.execute(inData, exec);
AutoBinnerApply applier = new AutoBinnerApply();
BufferedDataTable outData = applier.execute(op, inData, exec);
return new PortObject[] { outData, new PMMLDiscretizePreprocPortObject(op) };
}
use of org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize in project knime-core by knime.
the class AutoBinnerLearnNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
BufferedDataTable data = (BufferedDataTable) inObjects[0];
AutoBinner binner = new AutoBinner(m_settings);
BufferedDataTable inData = binner.calcDomainBoundsIfNeccessary(data, exec, Arrays.asList(m_settings.getTargetColumn()));
PMMLPreprocDiscretize op = binner.execute(inData, exec);
AutoBinnerApply applier = new AutoBinnerApply();
BufferedDataTable outData = applier.execute(op, inData, exec);
return new PortObject[] { outData, new PMMLDiscretizePreprocPortObject(op) };
}
use of org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize in project knime-core by knime.
the class AutoBinner method init.
/**
* Initialize instance and check if settings are consistent.
*/
private void init(final DataTableSpec inSpec) throws InvalidSettingsException {
PMMLPreprocDiscretize op = createDisretizeOp(null);
AutoBinnerApply applier = new AutoBinnerApply();
m_tableOutSpec = applier.getOutputSpec(op, inSpec);
m_pmmlOutSpec = new PMMLDiscretizePreprocPortObjectSpec(op);
}
use of org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize in project knime-core by knime.
the class AutoBinner method createDisretizeOp.
private PMMLPreprocDiscretize createDisretizeOp(final Map<String, double[]> edgesMap) {
Map<String, List<PMMLDiscretizeBin>> binMap = createBins(edgesMap);
List<String> names = new ArrayList<String>();
Map<String, PMMLDiscretize> discretize = new HashMap<String, PMMLDiscretize>();
for (String target : m_settings.getTargetColumn()) {
String binnedCol = m_settings.getReplaceColumn() ? target : target + " [Binned]";
names.add(binnedCol);
discretize.put(binnedCol, new PMMLDiscretize(target, binMap.get(target)));
}
DisretizeConfiguration config = new DisretizeConfiguration(names, discretize);
PMMLPreprocDiscretize op = new PMMLPreprocDiscretize(config);
return op;
}
use of org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize in project knime-core by knime.
the class AutoBinnerApplyNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inObjects, final ExecutionContext exec) throws Exception {
PMMLPreprocPortObject pmmlPort = (PMMLPreprocPortObject) inObjects[0];
BufferedDataTable inTable = (BufferedDataTable) inObjects[1];
validatePMMLPort(pmmlPort);
PMMLPreprocDiscretize op = (PMMLPreprocDiscretize) pmmlPort.getOperations().get(0);
AutoBinnerApply applier = new AutoBinnerApply();
BufferedDataTable binnedData = applier.execute(op, inTable, exec);
return new PortObject[] { binnedData };
}
Aggregations