Search in sources :

Example 6 with FullBinarySplitEnumeration

use of org.knime.base.node.mine.treeensemble2.data.TreeNominalColumnData.FullBinarySplitEnumeration in project knime-core by knime.

the class FullBinarySplitEnumerationTest method testBinarySplitEnumerationCountTuples.

@Test(timeout = 2000L)
public void testBinarySplitEnumerationCountTuples() {
    byte maxNrUniqueValues = 10;
    for (byte nrUniqueValues = 2; nrUniqueValues < maxNrUniqueValues; nrUniqueValues++) {
        BinarySplitEnumeration instance = new FullBinarySplitEnumeration(nrUniqueValues);
        final int expectedTupleCount = (int) Math.pow(2, nrUniqueValues - 1) - 1;
        int count = 0;
        do {
            count++;
        } while (instance.next());
        Assert.assertEquals("For test count = " + nrUniqueValues, expectedTupleCount, count);
    }
}
Also used : BinarySplitEnumeration(org.knime.base.node.mine.treeensemble2.data.TreeNominalColumnData.BinarySplitEnumeration) FullBinarySplitEnumeration(org.knime.base.node.mine.treeensemble2.data.TreeNominalColumnData.FullBinarySplitEnumeration) FullBinarySplitEnumeration(org.knime.base.node.mine.treeensemble2.data.TreeNominalColumnData.FullBinarySplitEnumeration) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 FullBinarySplitEnumeration (org.knime.base.node.mine.treeensemble2.data.TreeNominalColumnData.FullBinarySplitEnumeration)4 BigInteger (java.math.BigInteger)3 NominalBinarySplitCandidate (org.knime.base.node.mine.treeensemble2.learner.NominalBinarySplitCandidate)2 HashSet (java.util.HashSet)1 RandomDataImpl (org.apache.commons.math.random.RandomDataImpl)1 BinarySplitEnumeration (org.knime.base.node.mine.treeensemble2.data.TreeNominalColumnData.BinarySplitEnumeration)1 RandomBinarySplitEnumeration (org.knime.base.node.mine.treeensemble2.data.TreeNominalColumnData.RandomBinarySplitEnumeration)1