## 4 Materials and Methods
### Diagnostic Methods
#### 4.3.2 Case Based Ordering (CBO)  
For those diseases that were not excluded by the previous method, the system calculates and displays an indicative ranking (from the most likely disease to the least likely). Again, based on the information captured in the decision trees, the system provides for each disease the symptoms associated with it. Thus, it can make a comparison for each of the possible diseases between its symptoms and the symptoms given by the user and derive a similarity metric so that it can rank them. Specifically, a record was made for each disease of the symptoms found in the check points of the corresponding decision tree. Thus, a table was formed where each row represents a symptom and each column a disease. Table 4 depicts an indicative part of the table, showing the associated symptoms for 4 of the 12 diseases (where \"X\" means the presence of a symptom/parameter, whereas categorical values are displayed). The knowledge in this table has been implemented as cases in JSON format, one for each disease in the table. E.g., the JSON record for CERATOTHOA is:  
\"DISEASE\": \"ceratotho\",  
\"weightLoss\": false,  
\"deaths\": false,  
\"anorexia\": true,  
\"lethargy\": false,  
\"swimActivity\": false,  
\"colorDarkening\": false,  
\"discoloring\": false,  
\"mouthDeformity\": true,  
\"finTailRot\": false,  
\"scalesLoss\": false,  
\"bleeding\": false,  
\"stomatitis\": false,  
\"ulcers\": false,  
\"scoliosis-lordosis-hypercalcifications\": false,  
\"gillDiscoloring\": false,  
\"gillMucous\": true,  
\"anemicGills\": false,  
\"granulomatosis\": false }  
From the above JSON descriptions, instances containing the list of symptoms associated with the respective disease are generated. For example, the list of symptoms for \"ceratothea\" disease is as follows:  
[\"anorexia\",'mouthDeformity', 'gillMucous']  
These cases are called _basic cases_ and stored in the _case base_. Also, user input is captured as a list of symptoms, called an _input case_, as in the following example:  
['deaths:no', 'anorexia', 'lethargy','swimActivity:normal',  
'swimBladderControlloss', 'colorDarkening', 'visionDifficulties']  
In this method, diseases are ranked based on some _similarity metric_, which represents the degree of similarity between the user _input case_ and the disease _base case_ based on the reported symptoms and has a value in [0,1]. Existing similarity metrics are based on three key metrics:  
* a: number of common elements in the two lists
* b: number of elements present only in the user list (user provided symptoms)
* c: number of items present only in the disease list (disease symptoms)  
We considered several metrics for case similarity, like 'Jaccard, 'Sorensen-Dice', 'Otsuka-Ochiai', 'Braun-Blanquet', 'Simpson', 'Sokal & Sneath', and 'Kulczynski2'. Having experimented with the above metrics, we realized that their similarity values sometimes differ substantially. So, we decided to exclude the two of them that produce the max and min values. The rest were divided into two groups with relatively similar values. Then, we chose one of each group so that their average values were close to the average values of the other two. The _Jaccard_ and _Kulczynski2_ metrics [29] were chosen, which are calculated according to the following formulas:  
\[jacc=a/(a+b+c)\text{ or }=1\text{, if }a=b=c=0\]  
\[kulcz2=1\text{, if }a=b=c=0\]  
\[kulcz2=0\text{, if }(a=b=0\
eq c)\text{ or }(a=c=0\
eq b))\]  
\[kulcz2=[(a/(a+b))+(a/(a+c))]\text{, otherwise}\]  
The final similarity value is calculated as the average value of the values of the two metrics:  
\[similarity=\
icefrac{{1}}{{2}}\left(jacc+kulcz2\right)\]  
The method returns a list of the diseases ordered on the basis of the similarity values of their base cases compared to the user input. This is a type of case-based reasoning (CBR) method that follows the standard CBR cycle: retrieve-reuse-reuse-reuse-retain [6], where we use a novel combination of similarity metrics.