apriori algorithm

hey guys please help in coding apriori algorithm. i dont know how to go about it. As of now i have done this much. Please guide me. thanks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#include<iostream>
using namespace std;

class Apriori
{
    int item[100][100],C2[100],L2[100][100];
    int i,j,k,row,col;
public:
    void getdata();
    void getCandidateSet();
    void getFrequentItemSet();
    void prune();
    void countItems();
    void display();
};

void Apriori::getdata()
{
    cout<<"Enter the rows and cols";
    cin>> row >> col;
    for(i=1;i<=row;i++){
        for(j=1;j<=col;j++){
            cin >> item[i][j];
        }
    }
}

void Apriori::getCandidateSet()
{
     int count=0;

    for(i=1;i<=row;i++){
        for(j=1;j<=col;j++){
            count=0;
            if(item[i][j]==1)
            {
                count++;
                C2[j]+=count;
            }
        }
    }
    
    
    for(i=1;i<=col;i++)
    {
        cout << C2[i] << "\n";
    }
}

void Apriori::getFrequentItemSet()
{
  /** int min_sup=3;
    for(i=1;i<col;i++)
    {
        L1[i]=0;
        if(C2[i]>=min_sup)
        {
            L1[i]=C2[i];
        }
    }
    
     for(i=1;i<col;i++)
    {
      cout << L1[i] << "\n";
     }
    */
}

void Apriori::display()
{
    for(i=1;i<=row;i++){
	  for(j=1;j<=col;j++){
		cout<<"\t"<<item[i][j];
		}
	      cout<<"\n";
	  }
}

int main()
{
    Apriori a;
    a.getdata();
    a.display();
    a.getCandidateSet();
   // a.getFrequentItemSet();
    return 0;
}
Topic archived. No new replies allowed.