-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapriori.h
100 lines (73 loc) · 1.8 KB
/
apriori.h
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
88
89
90
91
92
93
94
95
96
97
98
99
100
//
// Created by Lenovo on 3/26/2018.
//
#ifndef APRIORI_APRIORI_H
#define APRIORI_APRIORI_H
#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <string>
#include <sstream>
#include <time.h>
#include <math.h>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <iomanip>
#include <typeinfo>
#include "chrono"
using namespace std;
//-------------------containers---------------------------
vector <int> L1;
typedef struct{
int a=0;
int b=0;
int freq=0;
}TwoStruct;
TwoStruct twoStruct;
vector <TwoStruct> C2, L2;
typedef struct {
int a;
int b;
int c;
int freq;
} ThreeStruct;
ThreeStruct threeStruct;
vector< ThreeStruct > L3,C3;
typedef struct {
int a;
int b;
int c;
int d;
int freq;
} FourStruct;
FourStruct fourStruct;
vector <FourStruct> C4,L4;
//-----------------------------------------------------------
//-------------------functions------------
void Execute();
//----------------varibles---------------------
int TID_Transactions = 1;
double minSupport;
double minConfidence;
int number_of_strong_rules=0;
int one_freq_itemset=0;
int two_freq_itemset=0;
int three_freq_itemset=0;
int four_freq_itemset=0;
#define maxItemID 200 //8
#define maxTransactions 1000 //6
//int maxItemID = 8;
string fileName;
int totalItems;
// itemIDcount is used to store number of times particular itemID appears in dataset.
// It is used to determine support for single elements. itemID will go from 1 to maxItemID
vector <int> itemIDcount;
//int itemIDcount[maxItemID];
// A single vector is associated with every itemID.
// That vector stores the TID [Transaction ID] in which particular itemID appears.
vector <vector <int>> itemId_TidMapping;
//----------------------------------------
#endif //APRIORI_APRIORI_H