Search in sources :

Example 11 with PMMLPreprocDiscretize

use of org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize in project knime-core by knime.

the class AutoBinnerApplyNodeModel method configure.

/**
 * {@inheritDoc}
 */
@Override
protected PortObjectSpec[] configure(final PortObjectSpec[] inSpecs) throws InvalidSettingsException {
    PMMLDiscretizePreprocPortObjectSpec pmmlPortSpec = (PMMLDiscretizePreprocPortObjectSpec) inSpecs[0];
    PMMLPreprocDiscretize op = pmmlPortSpec.getOperation();
    DataTableSpec dataSpec = (DataTableSpec) inSpecs[1];
    AutoBinnerApply applier = new AutoBinnerApply();
    return new PortObjectSpec[] { applier.getOutputSpec(op, dataSpec) };
}
Also used : PMMLDiscretizePreprocPortObjectSpec(org.knime.base.node.preproc.autobinner.pmml.PMMLDiscretizePreprocPortObjectSpec) DataTableSpec(org.knime.core.data.DataTableSpec) PMMLDiscretizePreprocPortObjectSpec(org.knime.base.node.preproc.autobinner.pmml.PMMLDiscretizePreprocPortObjectSpec) PortObjectSpec(org.knime.core.node.port.PortObjectSpec) PMMLPreprocDiscretize(org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize)

Example 12 with PMMLPreprocDiscretize

use of org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize in project knime-core by knime.

the class AutoBinner method createDisretizeOp.

/**
 * @param edgesMap the boundary map
 * @return the {@link PMMLPreprocDiscretize} model
 */
protected 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_included) {
        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;
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) DisretizeConfiguration(org.knime.base.node.preproc.autobinner.pmml.DisretizeConfiguration) ArrayList(java.util.ArrayList) PMMLDiscretize(org.knime.base.node.preproc.autobinner.pmml.PMMLDiscretize) ArrayList(java.util.ArrayList) List(java.util.List) PMMLPreprocDiscretize(org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize)

Example 13 with PMMLPreprocDiscretize

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, data.getDataTableSpec());
    String[] included = m_settings.getFilterConfiguration().applyTo(data.getDataTableSpec()).getIncludes();
    BufferedDataTable inData = binner.calcDomainBoundsIfNeccessary(data, exec, Arrays.asList(included));
    PMMLPreprocDiscretize op = binner.execute(inData, exec);
    AutoBinnerApply applier = new AutoBinnerApply();
    BufferedDataTable outData = applier.execute(op, inData, exec);
    return new PortObject[] { outData, new PMMLDiscretizePreprocPortObject(op) };
}
Also used : AutoBinnerApply(org.knime.base.node.preproc.autobinner.apply.AutoBinnerApply) BufferedDataTable(org.knime.core.node.BufferedDataTable) PMMLPreprocDiscretize(org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize) PMMLDiscretizePreprocPortObject(org.knime.base.node.preproc.autobinner.pmml.PMMLDiscretizePreprocPortObject) PMMLPreprocPortObject(org.knime.core.node.port.pmml.preproc.PMMLPreprocPortObject) PortObject(org.knime.core.node.port.PortObject) PMMLDiscretizePreprocPortObject(org.knime.base.node.preproc.autobinner.pmml.PMMLDiscretizePreprocPortObject)

Aggregations

PMMLPreprocDiscretize (org.knime.base.node.preproc.autobinner.pmml.PMMLPreprocDiscretize)13 AutoBinnerApply (org.knime.base.node.preproc.autobinner.apply.AutoBinnerApply)6 PMMLPreprocPortObject (org.knime.core.node.port.pmml.preproc.PMMLPreprocPortObject)5 PMMLDiscretizePreprocPortObjectSpec (org.knime.base.node.preproc.autobinner.pmml.PMMLDiscretizePreprocPortObjectSpec)4 BufferedDataTable (org.knime.core.node.BufferedDataTable)4 PortObject (org.knime.core.node.port.PortObject)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 List (java.util.List)3 DisretizeConfiguration (org.knime.base.node.preproc.autobinner.pmml.DisretizeConfiguration)3 PMMLDiscretize (org.knime.base.node.preproc.autobinner.pmml.PMMLDiscretize)3 PMMLDiscretizePreprocPortObject (org.knime.base.node.preproc.autobinner.pmml.PMMLDiscretizePreprocPortObject)3 DataTableSpec (org.knime.core.data.DataTableSpec)2 SQLException (java.sql.SQLException)1 DBAutoBinner (org.knime.base.node.io.database.binning.DBAutoBinner)1 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)1 ExecutionContext (org.knime.core.node.ExecutionContext)1 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)1 PortObjectSpec (org.knime.core.node.port.PortObjectSpec)1