My file is:
outlook temperature Humidity Windy PlayTennis
sunny hot high false N
sunny hot high true N
overcast hot high false P
rain mild high false P
rain cool normal false P
I found out unique elements from file as:
element:occurence
suny :2
overcast:1
rain:2
mild:1
cool:1
hot :4
normal:1
high:2
false:4
true:1
n:2
p:3
Then I removed elements whose occurrence was less than 1.
as output came as:
suny : 2
rain: 2
hot :3
high:4
false:4
n:2
p:3
Now I want output as (from the first output, it should loop with every other element to make a set of two frequent set)
element:occurence
sunny,hot:2
sunny,high:2
sunny,false:1
sunny,n:2
sunny,p:0
rain,hot:0
rain,high:1
rain,false:2
rain,n:0
rain,p:2
hot,high:2
hot,false:1
hot,n:2
hot,p:0
and so on..
Here is my code:
var occurences = File.ReadAllLines(file)
.Skip(1)
.SelectMany(l => l.Split(new []{' '},StringSplitOptions.RemoveEmptyEntries))
.GroupBy(w => w)
.ToDictionary(g => g.Key, g => g.Count());
foreach(var pair in occurences)
label1.Text += String.Format("{0}: {1}\n", pair.Key, pair.Value);
I implemented this to find the 1st frequent set.
For 2nd one what should I do?
I also need to find the third set.