# Coverage-Based Classification Using Association Rule Mining +
## 5 Our Associative Classification Approach--J&B
### Overall Coverage and Accuracy  
After our classifier is built (as in Section 5.1), it is straightforward to compute the overall coverage and accuracy of the classifier (defined in Algorithm 3). To compute the overall coverage, we count the examples that are covered by the classifier and divide it by the total number of examples in the dataset. For accuracy, we count all the examples that are classified by the classifier and divide it by the total number of examples in the dataset. The first line finds the length of the dataset. In the second and third lines, we fill all initial values of _classified_testdata_ (to compute the overall coverage) and _classified_testdata_withclass_ (to compute the overall accuracy) arrays as _false_. Lines 4-11 generally switch the status of the test example, without a class label to compute the overall coverage in lines 6-8 and with a class label to calculate the accuracy in lines 9-11. The number of correctly classified examples by classifier without class labels and with class labels are counted in lines 12-16 to calculate the overall coverage of the classifier, and overall accuracy is computed in lines 17-18. The last line returns the obtained results. ```
1:Dataset \(D\) and classifier \(C\)
2:Overall coverage and accuracy of the classifier
3:n = D.length();
4:_Fill_ (classified_testdata, false);
5:_Fill_ (classified_testdata_withclass, false);
6:_for_i: = 1 _to_ C.length _do_
7:for j: = 1 to n do
8:if C[i].premise classifies D[j].premise then
9:if classified_testdata[j] = false then
10: classified_testdata[j] = true;
11:if C[i] classifies D[j] then
12:if classified_testdata_withclass[j] = false then
13: classified_testdata_withclass[j] = true;
14:for i: = 1 to n do
15:if classified_testdata[i] then
16: testosterone++;
17:if classified_testdata_withclass[i] then
18: accuracy++;
19:Overallcoverage_testdata = testosterone/n;
20:Overallaccuracy_testdata = accuracy/n;
21:return_Overallaccuracy_testdata, Overallcoverage_testdata
```  
**Algorithm 3**Overall coverage and accuracy of the classifier  
**Example 1**. : _Let us assume we have given the following training dataset that is illustrated in Table 1 and we apply here minimum coverage threshold as 80%, that is, when our intended classifier covers at least 80% of the training examples, then, we stop._  
We have the following class association rules (shown in Table 2) (which satisfied the user-specified minimum support and confidence thresholds) that are generated based on minimum support and confidence thresholds which are discussed in the fourth section. In the second step, we sort the class association rules by confidence and support descending order. The result is shown in Table 3.  
In the next step, we form our classifier by selecting the strong rules. We select strong rules which contribute to improving the overall coverage, and we continue until achieving the intended training dataset coverage. Table 4 illustrates our final classifier. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**\#** & _a1_ & _a2_ & _a3_ & _a4_ & _a5_ & _Class_ \\ \hline
1 & \(3\) & \(4\) & \(2\) & \(1\) & \(3\) & \(1\) \\
2 & \(5\) & \(3\) & \(1\) & \(4\) & \(2\) & \(2\) \\
3 & \(1\) & \(5\) & \(2\) & \(4\) & \(2\) & \(1\) \\
4 & \(3\) & \(2\) & \(3\) & \(1\) & \(2\) & \(3\) \\
5 & _?_ & \(2\) & _?_ & \(3\) & \(5\) & \(1\) \\
6 & \(1\) & \(3\) & \(5\) & \(4\) & \(3\) & \(2\) \\
7 & \(2\) & \(2\) & \(1\) & \(2\) & \(2\) & \(2\) \\
8 & \(1\) & \(4\) & \(4\) & \(2\) & \(2\) & \(1\) \\
9 & \(1\) & _?_ & \(2\) & \(4\) & \(3\) & \(2\) \\
10 & \(1\) & \(5\) & \(1\) & \(1\) & \(5\) & \(3\) \\
11 & \(1\) & \(2\) & \(1\) & \(1\) & \(5\) & \(2\) \\
12 & \(1\) & \(4\) & \(4\) & \(4\) & \(2\) & \(1\) \\
13 & \(1\) & \(3\) & _?_ & _?_ & _?_ & \(2\) \\
14 & \(1\) & \(4\) & \(5\) & \(4\) & \(4\) & \(3\) \\
15 & \(3\) & \(2\) & \(2\) & \(1\) & \(2\) & _10_ \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Training dataset.