Search in sources :

Example 1 with TIDFrequentItemSet

use of org.knime.base.node.mine.subgroupminer.freqitemset.TIDFrequentItemSet in project knime-core by knime.

the class TIDApriori method getFrequentItemSets.

/**
 * {@inheritDoc}
 */
@Override
public List<FrequentItemSet> getFrequentItemSets(final FrequentItemSet.Type type) {
    List<FrequentItemSet> freqSets = new ArrayList<FrequentItemSet>();
    List<Integer> tids = new ArrayList<Integer>();
    for (int i = 0; i < m_dbsize; i++) {
        tids.add(i);
    }
    for (TIDItem i : m_alwaysFrequentItems) {
        List<Integer> id = new ArrayList<Integer>();
        id.add(i.getId());
        TIDFrequentItemSet freqSet = new TIDFrequentItemSet(Integer.toString(m_idCounter++), id, 1.0, tids);
        freqSets.add(freqSet);
    }
    if (type.equals(FrequentItemSet.Type.FREE)) {
        getFrequentItemSets(m_prefixTree, freqSets);
    } else if (type.equals(FrequentItemSet.Type.CLOSED)) {
        freqSets.addAll(getClosedItemSets());
    } else if (type.equals(FrequentItemSet.Type.MAXIMAL)) {
        freqSets.addAll(getMaximalItemSets());
    }
    return freqSets;
}
Also used : TIDFrequentItemSet(org.knime.base.node.mine.subgroupminer.freqitemset.TIDFrequentItemSet) ArrayList(java.util.ArrayList) FrequentItemSet(org.knime.base.node.mine.subgroupminer.freqitemset.FrequentItemSet) TIDFrequentItemSet(org.knime.base.node.mine.subgroupminer.freqitemset.TIDFrequentItemSet)

Aggregations

ArrayList (java.util.ArrayList)1 FrequentItemSet (org.knime.base.node.mine.subgroupminer.freqitemset.FrequentItemSet)1 TIDFrequentItemSet (org.knime.base.node.mine.subgroupminer.freqitemset.TIDFrequentItemSet)1