A Novel Fuzzy Logic-Based Medical Expert System for Diagnosis of Chronic Kidney Disease

Chronic kidney disease is a life-threatening complication. Primary diagnosis and active control avoid its progression. To increase the life span of a patient, it is necessary to detect such diseases in early stages. In this research paper, design and development of a fuzzy expert system (FES) to identify the current stage of chronic kidney disease is proposed. The proposed fuzzy rule-based expert system is developed with the help of clinical practice guidelines, database, and the knowledge of a team of specialists. It makes use of input variables like nephron functionality, blood sugar, diastolic blood pressure, systolic blood pressure, age, body mass index (BMI), and smoke. The normality tests are applied on diﬀerent input parameters. The input variables, i.e., nephron functionality, blood sugar, and BMI have more impact on the chronic kidney disease as shown by the response of surface analysis. The output of the system shows the current stage of patient’s kidney disease. Totally 80 tests were performed on the FES developed in this research work, and the generated output was compared with expected output. It is observed that this system succeeds in 93.75% of the tests. This system supports the doctors in assessment of chronic kidney disease among patients. The detection of chronic kidney disease is a serious clinical problem that comprises imprecision, and the use of fuzzy inference system is suggested to overcome this issue. The proposed FES is implemented in the MATLAB.


Introduction
Chronic kidney disease or chronic renal disorders arise due to the lack of functionality of nephrons in the kidney. It basically occurs when the kidney stops its functionality like the maintenance of pH value, water, and salt in the blood. e kidney is the natural filter of blood and it discharges the wastage from the body in the form of urine. is disease can also lead to the damage of other neighbor organs of a kidney.
Nowadays, due to increase in population and unhealthy lifestyle, number of patients with renal disorder is increasing [1][2][3]. It is tough for individual to recover from every kidney disease [5]. e detection of kidney disease and disorder can be done by studying the features extracted from an acquired image. e image-processing techniques are applied on magnetic resonance images of total kidney volume [6]. e registration is performed on the selected portion of an image to increase the accuracy [7]. e optimal path is detected during the segmentation of magnetic resonance images of kidneys for diagnosis of Chronic Kidney Disease (CKD) [8].
Computer aided diagnostic systems are used to examine the kidney features for the early identification of kidney diseases [9,10]. Certain test, like F-test, is applied to find out the dependency of features on the kidney area [11]. Ultrasonography images are also used for detection of stages of CKDs. e stages of CKD are predicted by using machine learning techniques [12][13][14][15]. e comparisons have been made between the performances of different systems developed by using various algorithms of machine learning [16]. Intelligent models are designed by using different methods of artificial neural networks, such as generalized feed forward neural network, back-propagation neural network, and modular neural network [17]. e Naive-Bayes method is also used to classify the various stages of CKD [18]. An approach is designed for detection of disease at initial stage by training the neural network with some amount of training data [19][20][21]. Further, the data mining algorithms and techniques are used for CKD detection [22,23]. Ensemble learning is used to clean the data that are acquired and to fill the values which are missing in that particular dataset to recalculate the different stages of CKD, and hence, the performance of the system is increased with this step [24]. e decision support systems are also built by using the information or dataset of CKD [25].
Early detection of the disease permits the doctor to suggest the required measure so that the risk may reduce [26]. e ranks are given to all the risk factors that extremely affect the kidney [27,28]. Renal illness is a public health problem across the nation. In Taiwan, there are over 1,100,000 patients living with CKD and this number is increasing gradually. Moreover, the data from United States Renal Data System (USRDS) stated that Taiwan has extreme occurrence of end stage kidney disease across the world [29,30].
In India, the death rate is increasing rapidly due to various chronic diseases, and CKD is one of the major diseases among them. e average age of a person that suffers from CKD is from 18 to 98 years in which the number of male patients is more than females [31]. e CKD is not detected easily till it grows due to its asymptomatic nature, and it results in decrease in the opportunities for prevention of the disease [32,33]. It is very important to detect and treat CKD in early stages to avoid kidney failure [34]. It is reported that this problem can be mitigated by developing fuzzy logic-based expert system [35]. e main objective of this work is to develop a medical expert system for diagnosis of chronic kidney disease by using fuzzy logic. e aim is to assist doctors in diagnosis of patients suffering from chronic kidney disease. Fuzzy logic is a rule-based logic that deals with imprecise concepts. It is a many-valued logic that can combine human heuristics into computer-assisted decision-making. e expert system is a computer program which is derived from the artificial intelligence and can be used in real-time applications [36]. Over 70%, this domain is used to solve the real-life applications [37]. e expert systems are used for diagnosis of various diseases. e main idea behind expert system is that the knowledge from the experts of a specific disease will be transferred to the computer system [38]. e knowledge stored in the computer system can be used by the user for specific task. After that, the system will conclude the result by doing various estimations. e fuzzy logic-based system is having three blocks and the fuzzy logic-based system used here is Mamdani type fuzzy model, all three blocks are discussed as follows: (1) Fuzzification: It is the process of transforming the crisp values into the fuzzy inputs. e crisp values are inputs measured by the sensors or the values given by the users [39].
(2) Inference mechanism: In the inference mechanism, the system maps rules satisfy input given by user and it gives an output. (3) Defuzzification: is is the last step in the system. In defuzzification process, a single number from the output of the aggregated fuzzy set is obtained.
Response surface methodology is a set of precise and numerical procedures that are supportive for exhibiting and analysimg issues wherever an interest response obtains the impact of various parameters, and also the aim is to maximise such response [39][40][41]. e research works discussed above provide fruitful information about the applications of expert systems for medical diagnosis and especially for the diagnosis of chronic kidney disease. e primary risk factors or causes of the chronic kidney disease have been used as the input variables in the development of a proposed medical expert system. After the processing of all blocks of fuzzy logic, it generates an output. In this developed medical expert system, the output is obtained according to the health of a patient who is suffering from this disease. e main limitations of this system are that the number of rules and input variables can be increased to get the more accurate result and also this system does not have capability to adapt itself according to the environment or to train itself from new examples. e rest of the paper is organized as follows. In Section 2, the related work is explained briefly. In Section 3, some established theories about fuzzy logic and notations used in the proposed system are discussed. In Section 4, the methodology for the proposed work including architecture of input-output parameters is described. e normality tests performed on different input variables are also shown in this section. e performance of the proposed system in terms of sensitivity, specificity, precision, and accuracy is evaluated in Section 5. In Section 6, the fuzzy expert system developed in this work along with ideas about future work is discussed. Finally, the work is concluded in Section 7.

Related Work
Kubota et al. [5] proposed a methodology by using imageprocessing technique in which the detection of the kidney failure of a patient has been done in the early stage based on information of kidney region. e required information is gathered from the CT image of kidney. e image of kidney is segmented into number of regions to collect correct and accurate information from it. Tang et al. [7] projected a method of registration known as intrasubject registration by using the local MI maximization. In this method, the registration is not done on the unified volumes that were acquired from the abdomen region of the patient's body. It will be accomplished only on the selected areas of kidney, which are affected by the disease. is method also increases the accuracy of performing registration. Bommanna Raja and Madheswaran [8] developed a computer aided system that examined the various features which are unconstrained and also independent of kidney's area. ese examined features are used in the developed system to examine the disease. Rovenţa and Roşu [37] developed a medical expert system to diagnose twenty-seven different kidney diseases from nine different categories. e identification of kidney disease is done by taking the symptoms that can be seen in clinical examination and the result evaluated in the laboratory test. e system was developed by using Visual Prolog 5.2 and helps the doctor to diagnose the disease more accurately.
Shen et al. [29] developed a low cost method for the patients of dialysis. is method is used to identify the risks of cardiovascular disease (CVD) on the chronic kidney disease (CKD). ECG features and heart rate variability of a patient are considered in this system. It uses the decisionbased neural network structure for the feature fusion. e overall accuracy of developed method for cardiovascular disease on chronic kidney disease is 71.07%. Adam and Hashim [19] used the artificial neural network technique for the detection of kidney problems in the initial stage. is method predicts various symptoms of kidney problem and then compares these symptoms with the mental behaviour of an individual. e artificial neural network is first trained by giving training samples, and then the testing procedure is done for the same. Chw et al. [17] designed intelligence models by using the various technologies of artificial neural network such as back-propagation network (BPN), generalized feed forward neural networks (GRNN), and modular neural network (MNN). ese methodologies are developed to detect the chronic kidney disease at initial stages. ese three models are compared with each other based on accuracy and effectiveness and also deployed on the Google Cloud platform. e constructed models help to avoid the chronic renal disorders in the beginning of the disease or in the introductory stages. Ahmed et al. [42] proposed a fuzzy expert system for the diagnosis of chronic kidney disease. e seven inputs were considered, and by using the values of these inputs, the membership functions are generated. e rules are further generated, and Matlab software is used to implement this research work. e output is predicted by expert system and it gave similar results as the human expert can give.

Notations and Preliminaries
e notations and preliminaries used in this work are as follows [43].

Crisp Sets.
e crisp set or the classical set is defined as the assemblage or group of elements x ∈ X that can be finite. For example, to define the set if elements are larger than 5, the membership function can be defined as follows: where X is the set of positive integers.

Fuzzy Sets.
If X is the set of elements denoted by x, then a fuzzy set A in X is the set of ordered pair and is represented by where μ A (x) � membership function of x in A.

Fuzzy Numbers.
A fuzzy number U is convex. A normalized fuzzy set U of the real line R, such that where μ U � membership function of fuzzy set. ere are many fuzzy numbers that exist. But in this work, only trapezoidal fuzzy numbers are used.

Trapezoidal Fuzzy Number (TrFN).
Assume an arbitrary trapezoidal fuzzy number U � (p, q, r, s). e membership function of U is represented by µ U and is given by

The Proposed Methodology
e methodology applied in this research work is shown in Figure 1.
e expert system has one layer. As shown in Figure 2, this layer detects the stage of CKD based on various input variables. e proposed expert system is explained mathematically as follows:

Selection of Input and Output Parameters.
e attributes should be selected carefully so that classification of patients can be done perfectly [44,45]. e details of seven input variables used in this research work are described as follows.

Nephron Functionality (NF).
e nephron functionality is the proportion of active nephron in the kidney [42]. e nephron functionality is in safe zone if the value is greater than 0.47. However, the functionality is moderately risky if the value is in between 0.3 to 0.5 and it is very-risky if it is below 0.35.

Blood Sugar (BS).
e amount of glucose available in the blood refers to the blood sugar. It is composed of three Mobile Information Systems fuzzy sets. If the level of blood sugar is below 104, then it is safe, whereas it is at borderline if it is between 104 to 150 and if the level is greater than 140 then the existence level of glucose in blood is high.

Diastolic Blood Pressure.
e diastolic blood pressure (DBP) is the function of congesting the heart with blood in between the muscle convulsion. It consists of 4 fuzzy sets. If the range is less than 89, then the diastolic blood pressure is low. If the range is between 87 to 110, then it is medium and if the range is between 106 to 121, then it is high. Nevertheless, if the range is above 118, then the diastolic blood pressure is extremely high.

Systolic Blood Pressure.
When the heart contracts, the systolic blood pressure (SBP) is stimulated. It is peculiarly the utmost arterial pressure during shrinkage of heart's left ventricle. e time at which ventricular contraction occurs is called systole. If the range of systolic blood pressure is below 134, then it is low; if the value is between 127 to 153, then it is medium; if the range is between 142 to 172, then it is high; and if the range is more than 162, then it is extremely high.

4.1.5.
Age. Patient's kidneys are devilishly affected by age. It includes three variables. If the age is under 36, then the patient is young; if age is within 33 to 66, the patient is considered as the mid-age person; and if the age is greater than 52, the patient is classified as old.
4.1.6. Body Mass Index (BMI). BMI is a simple and clinically useful data for CKD diagnosis. It is calculated by dividing the person's weight with square of height. It has four variables. A person is underweight if BMI is less than 19, normal weight if it is between 18.5 to 24.9, overweight if the value is 24.6 to 30, and obese if it is 29.5 or more.

Smoke.
Smoking plays a major role in disturbing the kidney. It has three fuzzy sets. It is low if the range is less than 2.64, medium if the range lies between 1.8 to 9.5, and high if the range is greater than 8.5. e output variable evaluates the condition of patient's kidney according to the behaviour of the input variables. e range of the output is from 0 to 10. e value 0 means that there is no hiccup in the patient's kidney and 10 means the patient is abundantly sick. is variable consists of six fuzzy sets.
(i) Healthy: e patient is healthy if the value of the output variable is less than 1.7. (ii) Concerning: e condition of the patient's kidney is concerning if the value of the output variable is within 1.5 to 3.26. (iii) Very concerning: If the range of output variable falls between 2.84 to 4.5, then the condition of kidney is considered as "very concerning". (iv) Sick: Sick class is assigned to the patients who get output value between 4 to 6. (v) Very sick: e patient is considered as very sick if the range of output variable is within 5.5 to 7.98. (vi) Extremely Sick: e condition of the patient's kidney is extremely sick if the output value is above 7.5.

Architecture for Input and Output Parameters.
ere are two ways to develop the architecture of input and output parameters: (1) e first way is to determine the ranges of variables such as nephron functionality, blood sugar, and BMI used in fuzzy set using the confidence intervals (CI) [46]. (2) e second way is to get them from the experts or Clinical Practice Guidelines (CPG).

Development of the Parameters Using CIs.
CIs are used on the sample of individuals from the target population because it is not possible to perform a study on entire population [39]. Sample data of 102 patients are taken, and to further obtain some important information from the  given sample, it is crucial to apply tests. Figures 3-5 depict  the normality tests applied on the dataset with Minitab 18 software. e normality tests used for this analysis are Anderson Darling and Ryan-Joiner normality test. To accept the null hypothesis, the P-value must be greater than 0.05, whereas value of correlation coefficient must be near to 1.
After the normality test, the next step is to apply confidence intervals to these three variables, i.e., Nephron Functionality, Blood sugar, and BMI. For example, in Table 1 the case of nephron functionality is mentioned, and the various parameters like mean are described as per interest.

Ranges of Input and Output
Parameters. An efficient analysis of each variable range determines the parameters corresponding to each variable. Figure 6 shows the membership function of the nephron functionality. Figure 7 shows the membership function of blood sugar by CIs and Figure 8 shows the membership function for BMI by CIs. With the information of the nephron functionality variable, the mathematical representation of the interval used in this model can be described as follows:

Knowledge Base (IF-THEN Rules Formulation).
In this phase, a group of rules is related to the fuzzy variables with the output classification. A knowledge base contains these fuzzy rules. e precedent-consequential way is followed for these rules. In this model, the Mamdani fuzzy rule-based model is applied, and these rules are stated as follows:

IF Nephron functionality is Very-Risky, And Blood sugar is High, And DBP is Extremely High, And SBP is Extremely High
And age is Old, And BMI is obese, And smoke is high, THEN patient's kidney is extremely sick. Table 2 shows the variables in FES, and the abovementioned rules are interpreted into fuzzy rules as presented in Table 3.
In the fuzzy inference system, the input-output rules play an important role. e efficiency of a proposed system is directly proportional to the I/O rules generated and stored in the knowledge base of expert system. Figure 9 presents the framework of knowledge base in which the rules are stored.
In the proposed model, there are seven variables; hence, it gives 5184 rules, but it is difficult to handle so many rules. erefore, in this work, 83 rules are used. ese rules have no omission because each of them has probability of its occurrence. e variables are chosen in such a way that the redundancy in rules can be avoided and impeded the dependency of one variable on other so that it will not affect the inference mechanism. e rules are also revised to find out the inconsistent rules, and the result of analysis showed positive outcomes. e abovementioned seven input variables are mixed and according to the reference rules the output is determined.

(7)
where IRT stands for Inference rules total. e defuzzification method computes the centre of gravity of images that is driven at the breakdown time of every input linguistic parameter. It implies that this method inspects the relationship between the degrees of membership of two joint sets and enumerates the outside of each subsequent image. e classic structure is utilized in the centroid method corresponding to the abscissa axis. e centre of gravity is in the middle of its base, in rectangles. Further, for triangles, it is set at the third part of its base as indicated by inverse side of the point inducted by hypotenuse and base. Finally, to obtain the total centroid, the summation of surface product of every figure is divided by its centroid into the total surface. [46].

Tests.
Here, the need was to interview the patients suffering from CKD. e proposed fuzzy expert system is validated.
is validation is done by various specialist doctors and experts from the nephrology and urology department. To evaluate confidence of the system, eighty tests are performed. Results are of a high certainty degree. e main aim of the evaluation of system is to identify the error percentage and imperfections which could be possibly found in the fuzzy expert system. It also helped to demonstrate the expectations that will be fulfilled by system and the possible error which further helped to calculate      Mobile Information Systems performance of system and where the performance measure was lacking behind, it helped to improve that problem. e various tests that were done with this fuzzy expert system are given in Table 4. In these tests, doctors evaluated suffering patients by this fuzzy expert system with various input variables that are used in the system, and then the obtained results were compared with the actual results. In Test 1, Nephron functionality is equal to 0.458, blood sugar is 132.2, Diastolic Blood Pressure is equal to 105.5, systolic Blood Pressure equal to 128.9, age is 38, BMI have the value 29.55, and smoke value is 2.037, and then control assessment by expert system for that particular patient's kidney condition is concerning. e result as per doctor is also that the kidney of the patient is in concerning phase.

Response Surface Analysis.
e system also gives the three-dimensional plot which describes the influence of input variables on output and output can also be calculated at particular inputs from this three-dimensional plot. ese surfaces are helping to depict the level of clinical variables that influence results. It can be seen as if the  combinations of variables are in light colour, then it means the optimal zone, whereas if the colour of combination is dark, then the variable levels activate a nonoptimal zone, which indicates a possibility of having CKD to a particular patient.

Experimental Results and Analysis
Eighty tests were carried out to analyse CKD using developed fuzzy expert system. e team of doctors also diagnosed each patient and gave result for same. After that, the results given by experts are compared with obtained results from the fuzzy expert system. By correlating the two results, 75 out of 80 tests were correctly classified, and hence the system showed 5 errors. A sample of tests is shown in Table 4. In Table 5, the confusion matrix is given. 80 cases of different patients are carried out. In the first column, 15 cases of healthy patients are considered and all of them are classified into correct class, i.e., healthy class. In the second column, the data of 10 patients at the concerning level is considered, but as a result out of 10 cases, 8 cases are exactly classified into concerning class and rest of 2 are classified into sick class. Similarly, in the third column, 16 cases very concerning are carried out, and from those 16 cases 15 are classified correctly and one is classified into class sick. In the fourth column, out of 11 diagnosed patients, 1 is classified incorrectly and 10 are in exact class. Likewise, fifth column illustrates that 14 diagnosed patients of class very sick are classified in correct class. At last, the sixth column shows that there are 14 cases of extremely sick patient, but out of 14, 1 is misclassified.
confidence indicator � success number total number of tests * 100 , where number of successes � 75 and total number of tests � 80.
It was examined that 93.75% of the results given by fuzzy expert system are classified correctly by calculating the confidence indicator using above formula. erefore, by observing the confidence indicator, it can be said that the developed fuzzy expert system can work as the supporting tool for doctors in diagnosis of CKD.
e results show that the categorization by fuzzy inference system for CKD is 06.25% wrong. Now, the first three classes that is healthy, concerning, and very concerning are taken as "no". Similarly, the rest of classes sick, very sick, and extremely sick are taken as "yes". Hence, the confusion matrix shown in Table 4 is reduced to 2 * 2 matrix and shown in Table 6. e performance of developed medical expert system is evaluated by considering various parameters like accuracy, precision, specificity, and sensitivity.
In case of CKD, from ese calculated parameters are shown in the form of graph in Figure 10.
e main aim to develop this expert system is that it will help doctors to identify the CKD in patients. is medical Figure 9: Input-output rules for the proposed expert system. expert system is able to diagnose the disease and can help specialist to provide an appropriate and suitable treatment for disease.
To portray the behaviour of two given variables in 3dimensional surface, the response surface is used. It explains the probability of risk with which a person suffers on two considered variables. ree plots are considered in this work. First in Figure 11, it is the plot between BMI and nephron functionality. e response surface plot of variable BMI and nephron functionality is analysed by test 2 in which the value of BMI is 35 and similarly value of nephron functionality is 0.1. From plot, it can be estimated easily that at these values, the result is high i.e. extremely sick.
Furthermore, by Figures 12 and 13, the output can be estimated by considering blood sugar with nephron functionality and BMI with blood sugar, respectively. With a complete analysis of all the potential instances of test two response surface plots, and with grouping of seven parameters, it is found that the parameters with most extreme impact in diagnosis of CKD are nephron functionality, blood sugar, and BMI. ese three variables have the highest effect   Class names  15  00  00  00  00  00  Healthy  00  08  00  00  02  00  Concerning  00  00  15  01  00  00  Very concerning  01  00  00  10  00  00  Sick  00  00  00  00  14  00  Very sick  00  00  01  00  00  13 Extremely sick on patient's health in case of CKD. erefore, doctors must give appropriate recommendation to patients to make their health stable and be cured in time from this CKD. Figure 14 shows the input values of various input variables used in medical expert system for diagnosis of CKD and output corresponding to given inputs. Image-processing techniques such as registration of an image, segmentation of an image, and extraction of features have also been applied on acquired magnetic resonance images and computed tomography images.
Additionally, the artificial neural network techniques such as backpropagation neural network and modular neural network are also used for the detection of CKD. Moreover, many systems have been proposed by using machine learning algorithms for the diagnosis of CKD such as k star and k nearest neighbor classifier to classify the stage of the disease into different classes according to the symptoms and risk factors.
All these abovementioned techniques deal with the crisp numbers. e developed system in this work deals with the fuzzy values, and it has also given more accuracy than these techniques.

Discussion
e developed fuzzy logic-based medical expert system is a supporting tool in decision-making about diagnosis of CKD. Although, specialist doctor's decision will be considered as final, the developed medical expert system can also make decision as a specialist doctor. Hence, it could be a very useful tool for assisting medical doctors for the robust decision regarding the CKD. e fuzzy expert system can also be suitable in remote areas, such as villages, and small towns, as there is always scarcity of specialists in such places. is expert system can also help to train the new doctors who do not have enough experience to diagnose the CKD, because this fuzzy expert system has knowledge and information stored in knowledge base that was acquired from specialists of the disease. Hence, it can be used as a training tool as well.
e accuracy obtained from the developed system is 93.75%. It means the system is successful in identification of 93.75% of the total cases considered in this research work. Another performance parameter considered in this work is precision. e precision obtained from this developed system is 92.5%. It means the developed system is having high quality of giving exact and clear results. Similarly, the     sensitivity and specificity of developed system are 94.87% and 92.68%. It means developed system is capable of measuring the proportion of actual positives and negatives which are correctly determined as such. e whole work done in this study is new and original as the clinical tests, and risk factors considered in this study have not been incorporated in the systems similar to it. e various research works are discussed in Introduction to understand more about risk factors, prevention, and treatment of CKD. Competitive advantage is that the proposed expert system is able to diagnose the disease with various variations in input variables. Variation states considered in this work are healthy, concerning, very concerning, sick, very sick and extremely sick. e main contribution of this work is that it is a supporting tool which is capable to make decisions, or it supports the decision-making process according to the given inputs to system by the user to identify whether the patient is suffering from CKD or not. To improve the success rate of fuzzy expert system, the recommendation is to gather more knowledge about the disease from specialist doctor and make rules as enough as possible. One can also increase the number of variables used as input to recognize the CKD and make their range accordingly so that the result can be calculated more accurately.

Conclusion
e diagnosis of chronic kidney disease is a difficult task. ere is always some possibility of misdiagnosis that leads to wrong treatment. is work proposes a fuzzy expert system that can help a doctor and nonspecialist to examine the chronic kidney patient. e fuzzy expert system is based on clinical test ranges. It works on two types of information, that is, the knowledge acquired from specialist doctors and experts from the nephrology and urology departments.
is study also gives response surface plot of various input variables used to recognize the disease. is system can give correct results about the health status of a patient.
In the current state, it would be inappropriate to say that the developed fuzzy expert system will replace the specialist doctors or knowledge of the team of doctors. However, this could be a supporting tool for doctors that could assist in decision-making and does not replace their admirable work. In addition, only computer and software are required to implement this medical expert system. erefore, this system can be used in hospitals, where there is lack of resources and can be used in those geographic areas where hospitals are not available.
Data Availability e data are available on request on demand through the first author jimmy.21733@lpu.co.in. or via phone +9779288330.

Conflicts of Interest
e authors declare that there are no conflicts of interest regarding the publication of this paper.