# Coverage-Based Classification Using Association Rule Mining +
## 5 Our Associative Classification Approach--J&B
### Our Intended Classifier  
Once we generated the strong class association rules in Section 4, we propose our classifier by using them. Our proposed method is outlined in Algorithm 1.  
Lines 1-2 find all frequent itemsets in the training dataset by using the \"APRIORI\" algorithm described in Section 4. The third line generates strong class association rules that satisfy the minimum support and confidence constraints from frequent itemsets. Class association rules (generated in line 3) are sorted by confidence and support descending order in the fourth line by the following criteria: Given two rules \(R_{1}\) and \(R_{2}\), \(R_{1}\) is said to have a higher rank than \(R_{2}\), denoted as \(R_{1}>R_{2}\),  
* If and only if, \(conf(R_{1})>conf(R_{2})\); or
* If \(conf(R_{1})=conf(R_{2})\) but, \(supp(R_{1})>supp(R_{2})\); or
* If \(conf(R_{1})=conf(R_{2})\) and \(supp(R_{1})=supp(R_{2}),\ R_{1}\) has fewer attribute values in its left-hand side than \(R_{2}\) does;
* If all the parameters of the rules are equal, we can choose any of them.  
Initial values of _classified_traindata_ array are filled with _false_ value in line 5. This array is used later to compute the overall coverage of the training data. Basically, the classifier is built in lines 6-17. We scan the training dataset for each rule (lines 6-7): if the rule classifies a new unclassified example 5 (that is, the rule's body matches the new example's body), then we increase the contribution (that is, the contribution of the rule to increase the overall coverage) in lines 8-11. If _contribution_ is higher than 0, that is, the rule classified new example(s), then we increase the overall coverage by _contribution_, and we add that rule to our final classifier in lines 12-14. If the rule can classify training examples, but cannot contribute to the betterment of the overall coverage, then we do not evaluate that rule as a potential rule for our classifier. Lines 15-16 stop the procedure if the classifier achieves the intended overall coverage that is higher than the user-defined _intended_coverage_ threshold, and line 17 returns the proposed classifier.  
```
0: A training dataset D, minimum support and confidence constraints, intended coverage
0: A subset of strong class association rules for classification
1:\(D\) = training_dataset;
2: F = frequent_ittemsets(D);
3: Rule = genCARS(F);
4: Rule = sort(R, minconf, minsup);
5: Fill(classified_traindata, false):
6:for i: = 1 to Rule.length do begin
7:for j: = 1 to D.length do begin
8:if classified_traindate[j] = false then
9:if Rule[i].premise classifies D[j].premise then
10: classified_traindate[j] = true;
11: contribution = contribution + 1;
12:if contribution > 0 then
13: overall_coverage = overall_coverage + contribution;
14: Classifier = Classifier.add(rule[i]);
15:if (overall_coverage/D.length) \(\geq\) intended_coverage then
16:break;
17:return Classifier
```  
**Algorithm 1**Building a compact and accurate classifier--J&B  
Algorithm 2 depicts the procedure of using the J&B classifier to find the class label of a (new) test example. For each rule in the J&B classifier (line 1): if the rule can classify the example correctly, then we increase the corresponding class count by one and store it (lines 2-3). If none of the rules can classify the new example correctly, then the algorithm returns the majority class value (lines 4-5); otherwise, it returns the majority class value of correctly classified rules (lines 6-7).