Why i am getting this error? How do i correct this error?
显示 更早的评论
minSup = 0.6; % minimum support threshold 0.6
[F,S] = findFreqItemsets(transactions,minSup);
fprintf('Minimum Support : %.2f\n', minSup)
fprintf('Frequent Itemsets Found: %d\n', sum(arrayfun(@(x) length(x.freqSets), F)))
fprintf('Max Level Reached : %d-itemsets\n', length(F))
fprintf('Number of Support Data : %d\n', length(S))
Undefined function or variable 'findFreqItemsets'.
1 个评论
Guillaume
2015-12-19
Please not create multiple posts of the same question.
回答(1 个)
That error message is quite clear: you are getting the error because although you are calling findFreqItemsets it has not been defined anywhere as a function or variable. Perhaps this might give you a hint to look for findFreqItemsets? For me it was very quick: one second with an internet search engine showed me that your code is copied from this page:
but you failed to actually read the whole page and notice that the code for the function is presented at the end of the post, under this title:
Appendix: Code used for this post
Here is the code used for this post.
findFreqItemsets() generates frequent itemsets using the Apriori method.
function [F,S,items] = findFreqItemsets(transactions,minSup,oneItemsets)
%FINDFREQITEMSETS generates frequent itemsets using Apriori method
% |transactions| is a nested cell array of transaction data or a table
% with |Value| column that contains such cell array. Each row contains a
% nested cell array of items in a single transaction. If supplied as a
% table, it also needs |Key| column with a cell array of transaction ids.
etc
If you want to use this function then you need to copy all of it, and make a new M-file and paste that text into the M-file and then save the M-file somewhere on your MATLAB path using the same name as the fucntion. Then you will be able to use it.
There are several functions presented as the end of that blog entry, and there may be dependencies between them. You will have to check this yourself.
类别
在 帮助中心 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!