## 3 Case-Based \"FCTF\" Reasoning System
### Case-Based \"FCTF\" Reasoning System  
Case-based FCTF reasoning system is shown in Figure 2.  
Figure 2: Case-based FCTF reasoning system. As shown in Figure 2, the system starts with the least number of features; one, for example. If the prediction accuracy cannot be reached, we increase the number of features and do the case-based learning again. **Retrieve:** Remembering is the process of retrieving a case or set of cases from memory. The case element may be a crisp number or a more complicated one. **Reuse:** If we find the same case, we just set the solution of the case in the case base as the solution of the new case, if we cannot, we find the nearest case and output according to this case. **Reuse:** Evaluate the solution and revise it based on the real situation. **Retain:** Keep this solution to the basement. The following is the pseudocode of the reasoning algorithm. Crisp reasoning algorithm: (1) \(n=1\); (2) while(accuracy \(>\)\(\alpha\)); (3) for \(j=1\) to r do; (4) for \(i=1\) to \(n\) do; (5) Computedist(\(A_{(r+1)i}\), \(A_{ji}\)); (6) Endfor; (7) Compute _dist_(\(R_{(r+1)i}\), \(R_{i}\)); (8) Endfor; (9) Find the rule number with the minimum value of _dist_(\(R_{(r+1)i}\), \(R_{i}\)): _minj_; (10) Output(\(y(R_{minj})\)); (11) \(n\)++; (12) End while. In a case-based reasoning system, one key point is to compute the similarities between a query and old cases to decide which case is most similar to the new coming one. Normally, the similarity between a query and an old case is calculated by the accumulated similarities on all counted features. The similarities are also influenced by the calculation methods. For example, in one method, two cases can be treated as similar, while in another method, two cases with various values on one nominal feature can possibly be considered as similar through exploring general domain knowledge. There are many methods to compute the similarities between a query and old cases. Here, we just give an example of a calculation method, the Euclidean metric, to compare the similarity of the cases if the case is a set of features, each of which is a crisp number. Assume that there are \(r\) rules in the rule set with the same structure, we first compute the distance between the prerequisite of the \(R_{(r+1)}\) and \(R_{i}\), denote it as _dist_(\(A_{(r+1)i}\), \(A_{ji}\)), which can be calculated as \((A_{(r+1)i}-A_{ji})\). Then, we find the rule number with the minimum value of _dist_(\(R_{(r+1)i}\), \(R_{i}\)) and denote it as _minj_. To calculate the Euclidean metric of the prerequisite between two rules, we compute the distance between one variable value in one rule and the corresponding variable value in the other rule, and then do the same to the next variable value and the corresponding variable value in the other rule, and so on. Finally, we calculate the _dist_(\(R_{(r+1)}\), \(R_{i}\)) according to the equation following:  
\[dist(R_{(r+1)i}\), \(R_{i}\)) = sqrt(\(\sum_{i}*(A_{(r+1)i}-A_{ji})^{2}\)) (1)  
For example, if we want to compare the Euclidean metric between \(R_{1}\) and \(R_{2}\), we should compute the distance between the first element of the prerequisite in \(R_{1}\) \"\(A_{11}\)\" and the first element of the prerequisite in \(R_{2}\) \"\(A_{21}\)\" yielding _dist_(\(A_{11}\), \(A_{21}\)). We then do the same for the second element of the prerequisite in \(R_{1}\) and the second element of the prerequisite in \(R_{2}\) yielding _dist_(\(A_{12}\), \(A_{22}\)). At this point, we use the equation above to calculate _dist_(\(R_{1}\), \(R_{2}\)). \(\alpha\) in line 1 is a user-specified threshold to control the reasoning process. Its value determines the accuracy of the reasoning system: if \(\alpha\) is bigger, the reasoning system is more accurate.