Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function nextWords = apriori_gen(words, sortedA)
- %-----------------------------------------------------------
- % created by Jan Hrdlicka, 16.9.2010
- %-----------------------------------------------------------
- % Generates next level words(itemsets).
- % input is cell array "words" with words (arrays of items represented by numbers)
- % and vector of sorted items "sortedA" with size 1xM, where M is number of
- % items.
- % Size of the cell array "words" is Nx1, where N is number of words. Word
- % is vector with size 1xI, where I is number of items in the current word.
- nextWords = {};
- for i = 1:size(words, 2)
- actWord = words{1,i};
- ind = find(sortedA==actWord(end));
- if ind~=length(sortedA)
- for j = sortedA(ind+1:end)
- nextWords{end+1,1} = [actWord j];
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment