TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
paan cool
NA
9
11.6k
C# problem.....lambda expression in find item support for combination itemset
May 6 2012 2:03 AM
Good morning guys, I have problem in C# coding where my scope is in data mining of association rules....below are description of my problem....can yours give me where my mistakes that should i fix it...i can find item support for 1-itemset but failed to find item support for k-itemset......i seek help from advance...
==============================
========================
46 31 9 25 12 45 33
25 12 28 36 38
25 12 9 36 38
12 9 36 25 28 34
36 9 12 16 25 28 44
12 25 28 16 21
11 36 25 12 45 44
46 25 12 9 16 28 44
28 17 32 44 12
31 44 32 28 9
--> this is a dataset that i ake it as my experiments
==============================
=======================
int size = -1;
string output = "";
string output1 = "";
string output2 = "";
string text = File.ReadAllText(@"C:\Users\AC
ER\Desktop\Apriori Demo\UCI
dataset\sample.txt"); //D:\PITA\projek\nursery.txt
size = text.Length;
string b;
b = text.Replace("\r\n", " ");
output += b;
string[] c = output.Split(' ');
List<String> cc = new List<String>(c);
cc.Sort();
var fr = cc.GroupBy(n => n).Select(n => new { Value = n.Key, Count =
n.Count() });
foreach (var f in fr)
{
string text2 = (string.Format("{0} : {1}/10 : {2}%", f.Value, f.Count,
(f.Count/f.Count)*100));
output1 += text2 + "\n" ;
}
richTextBox4.Text = output1;
--> this is c# coding for 1-itemset....and its work!!
==============================
=======================
Output:
11 : 1/10 : 100%
12 : 9/10 : 100%
16 : 3/10 : 100%
17 : 1/10 : 100%
21 : 1/10 : 100%
25 : 8/10 : 100%
28 : 7/10 : 100%
31 : 2/10 : 100%
32 : 2/10 : 100%
33 : 1/10 : 100%
34 : 1/10 : 100%
36 : 5/10 : 100%
38 : 2/10 : 100%
44 : 5/10 : 100%
45 : 2/10 : 100%
46 : 2/10 : 100%
9 : 6/10 : 100%
--> this is output for 1-itemset....
==============================
========================
below are combination itemset code where i can find what itemset combination but im stuck when to find it itemsupport for combination data
lbCombinations.Items.Clear();
int n = richTextBox4.Lines.Length;
int k = 2;
Combination c = new Combination(n, k);
string[] result = new string[k];
string output1 = "";
while (c != null)
{
result = c.ApplyTo(richTextBox7.Lines);
StringBuilder sb = new StringBuilder();
sb.Append("{ ");
for (int i = 0; i < result.Length; ++i)
{
List<String> ccc = new List<String>(result);
ccc.Sort();
var fru = ccc.GroupBy(m => n).Select(m => new { Value = m.Key,
Count = m.Count(), Key = m.Key, Min = m.Min(), Max =
m.Max() });
foreach (var f in fru)
{
sb.AppendFormat("{0} ", result[i]);
}
}
sb.Append("}: ");
for (int i = 0; i < 1; ++i)
{
List<String> ccc = new List<String>(result);
ccc.Sort();
var fru = ccc.GroupBy(m => m).Select(m => new { Value = m.Key,
Count = m.Count(), Key = m.Key, Min = m.Min(), Max =
m.Max() });
foreach(var f in fru)
{
sb.AppendFormat("{0}", f.Key);
}
}
lbCombinations.Items.Add(sb.To
String());
c = c.Successor();
}
==============================
========================
this is output for combination itemset...
p/s: its successfully generated combination itemset but the item support i failed get it... :(
{11 12} : 11 12
{11 16} : 11 16
{11 17} : 11 17
{11 21} : 11 21
{11 25} : 11 25
{11 28} : 11 28
{11 31} : 11 31
{11 32} : 11 32
{11 34} : 11 34
{11 36} : 11 36
{11 38} : 11 38
....
....
....
{46 9 } : 46 9
==============================
=======================
where, its must produce output like this......
{11 12} : 1/10
{11 16} : 0/10
{11 17} : 0/10
{11 21} : 0/10
{11 25} : 1/10
{11 28} : 0/10
{11 31} : 0/10
{11 32} : 0/10
{11 34} : 0/10
{11 36} : 1/10
{11 38} : 0/10
....
....
....
{46 9 } : 2/10
==============================
========================
i hope guts can give me a way to solve this problem....thank you....sorry for any convenience...
Reply
Answers (
3
)
Event And Delegate In C#
Performance