Search in sources :

Example 51 with FilterResult

use of org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult in project knime-core by knime.

the class NameFilterConfigurationTest method testShuffledWithSomeMissingAndSomeExtra_Enforce.

@Test
public void testShuffledWithSomeMissingAndSomeExtra_Enforce() throws Exception {
    NameFilterConfiguration conf = createConfiguration(EnforceOption.EnforceExclusion);
    FilterResult applyTo = conf.applyTo(new String[] { "N1", "E1", "I3", "I2", "N2", "N3" });
    Assert.assertArrayEquals(applyTo.getIncludes(), new String[] { "N1", "I3", "I2", "N2", "N3" });
    Assert.assertArrayEquals(applyTo.getExcludes(), new String[] { "E1" });
    Assert.assertArrayEquals(applyTo.getRemovedFromIncludes(), new String[] { "I1" });
    Assert.assertArrayEquals(applyTo.getRemovedFromExcludes(), new String[] { "E2" });
}
Also used : FilterResult(org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult) Test(org.junit.Test)

Example 52 with FilterResult

use of org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult in project knime-core by knime.

the class NameFilterConfigurationTest method testSomeMissing.

private void testSomeMissing(final NameFilterConfiguration conf) {
    FilterResult applyTo = conf.applyTo(new String[] { "I1", "I3", "E1" });
    Assert.assertArrayEquals(applyTo.getIncludes(), new String[] { "I1", "I3" });
    Assert.assertArrayEquals(applyTo.getExcludes(), new String[] { "E1" });
    Assert.assertArrayEquals(applyTo.getRemovedFromIncludes(), new String[] { "I2" });
    Assert.assertArrayEquals(applyTo.getRemovedFromExcludes(), new String[] { "E2" });
}
Also used : FilterResult(org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult)

Example 53 with FilterResult

use of org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult in project knime-core by knime.

the class NameFilterConfigurationTest method testGoodCaseAllAvailable.

private void testGoodCaseAllAvailable(final NameFilterConfiguration conf) {
    FilterResult applyTo = conf.applyTo(new String[] { "I1", "I2", "I3", "E1", "E2" });
    Assert.assertArrayEquals(applyTo.getIncludes(), m_defIncludes);
    Assert.assertArrayEquals(applyTo.getExcludes(), m_defExcludes);
    Assert.assertArrayEquals(applyTo.getRemovedFromIncludes(), new String[0]);
    Assert.assertArrayEquals(applyTo.getRemovedFromExcludes(), new String[0]);
}
Also used : FilterResult(org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult)

Example 54 with FilterResult

use of org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult in project knime-core by knime.

the class OneWayANOVANodeModel method execute.

/**
 * {@inheritDoc}
 */
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception {
    DataTableSpec spec = inData[0].getSpec();
    FilterResult filter = m_settings.getTestColumns().applyTo(spec);
    ExecutionMonitor groupExec = exec.createSubProgress(0.3);
    ExecutionMonitor oneWayAnovaExec = exec.createSubProgress(0.3);
    // runs twice, maybe
    ExecutionMonitor leveneExec = exec.createSubProgress(0.4);
    exec.setMessage("Determining groups");
    List<String> groups = getGroups(inData[0], groupExec);
    groupExec.setProgress(1.0);
    exec.setMessage("Computing ANOVA");
    OneWayANOVA test = new OneWayANOVA(filter.getIncludes(), m_settings.getGroupingColumn(), groups, m_settings.getConfidenceIntervalProb());
    OneWayANOVAStatistics[] result = test.execute(inData[0], oneWayAnovaExec);
    oneWayAnovaExec.setProgress(1.0);
    exec.setMessage("Computing Levene");
    LeveneTest leveneTest = new LeveneTest(filter.getIncludes(), m_settings.getGroupingColumn(), groups, getGroupSummaryStats(result));
    LeveneTestStatistics[] leveneResult = leveneTest.execute(inData[0], leveneExec);
    leveneResult[0].getTTestCells();
    leveneExec.setProgress(1.0);
    exec.setMessage("Assembling output");
    m_descStats = getDescriptiveStatisticsTable(result, exec);
    m_leveneStats = getLeveneStatistices(leveneResult, exec);
    m_stats = getTestStatisticsTable(result, exec);
    return new BufferedDataTable[] { m_stats, m_leveneStats, m_descStats };
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) LeveneTest(org.knime.base.node.stats.testing.levene.LeveneTest) BufferedDataTable(org.knime.core.node.BufferedDataTable) FilterResult(org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult) ExecutionMonitor(org.knime.core.node.ExecutionMonitor) LeveneTestStatistics(org.knime.base.node.stats.testing.levene.LeveneTestStatistics)

Aggregations

FilterResult (org.knime.core.node.util.filter.NameFilterConfiguration.FilterResult)54 DataTableSpec (org.knime.core.data.DataTableSpec)29 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)29 DataColumnSpec (org.knime.core.data.DataColumnSpec)19 ArrayList (java.util.ArrayList)14 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)13 DataType (org.knime.core.data.DataType)10 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)10 BufferedDataTable (org.knime.core.node.BufferedDataTable)9 DataColumnSpecCreator (org.knime.core.data.DataColumnSpecCreator)6 PortObjectSpec (org.knime.core.node.port.PortObjectSpec)6 HashSet (java.util.HashSet)5 DataCell (org.knime.core.data.DataCell)5 DoubleValue (org.knime.core.data.DoubleValue)5 HashMap (java.util.HashMap)3 DataColumnProperties (org.knime.core.data.DataColumnProperties)3 DataRow (org.knime.core.data.DataRow)3 PMMLPortObjectSpecCreator (org.knime.core.node.port.pmml.PMMLPortObjectSpecCreator)3 LinkedHashMap (java.util.LinkedHashMap)2 LinkedHashSet (java.util.LinkedHashSet)2