Automatic Heart Disease Diagnosis System Based on Artificial Neural Network (ANN) and Adaptive Neuro-Fuzzy Inference Systems (ANFIS) Approaches

This paper aims to design and implement an automatic heart disease diagnosis system using MATLAB. The Cleveland data set for heart diseases was used as the main database for training and testing the developed system. In order to train and test the Cleveland data set, two systems were developed. The first system is based on the Multilayer Perceptron (MLP) structure on the Artificial Neural Network (ANN), whereas the second system is based on the Adaptive Neuro-Fuzzy Infe-rence


Introduction
Recently, heart disease has become one of the most prevalent diseases which people are being suffered from.According to statistics, it is one of the most important causes of deaths all over the world (CDC's report).Many factors, such as clinical symptoms and the relation between the functional and the pathologic manifestations of heart diseases and other human organs rather than heart, complicate the diagnosis of it and result in delay in correct diagnosis decision.Therefore, diagnosing of the heart disease is an essential matter in health care industry and many researchers try to develop medical decision support systems (MDSS) to help physicians.These systems are developed to moderate the diagnosis time and enhance the diagnosis accuracy in addition to supporting increasingly complicated diagnosis decision process [1] [2].
Currently, hospital information systems using decision support systems have different tools available to obtain data, but they are still restricted.These tools can just answer some simple queries like "identifying the male patients who are below 20 years old, and single who have been treated for heart attack".However, they are not able to answer complex queries "given patient records, predicting the probability of patients getting a heart disease" as an example [3].
According to [4], clinical decisions are often made based on doctors' intuitions and heuristics experience rather than on the knowledge rich data hidden in the database.They lead to unwanted biases, errors and excessive medical costs which affects the quality of treatment provided to patients [5].Motivated by the necessity of such a system, in this paper, a method is suggested to efficiently diagnose the heart disease, which results in decreasing medical errors and superfluous practice variation, decreasing diagnostic time and enhancing patient safety and satisfaction.
This paper presents a decision support system for heart disease classification using neural network.The data set used is the Cleveland Heart Database taken from UCI learning data set repository which was donated by Detrano.The data set is being divided into two classes: 0 corresponding to absence of any disease and 1 corresponding to presence of disease.
The rest of the paper is organized as follows.Related works are presented in Section 2. In Section 3, research algorithms and concepts are described.Automated heart disease diagnosis system's design and implementation details are presented in Section 4. In Section 5, experimental results are presented and discussed in details.The study is finally concluded in Section 6.

Related Works
Until now, various classification algorithms have been employed on heart disease data set and high classification accuracies have been reported in the last decade.Cleveland heart disease database is one of the most accurate existing databases.Robert Detrano created this database in V.A. Medical Center, Long Beach and Cleveland Clinic Foundation in 1988.Since 1988, researchers worked a lot on classification of its data by using various classification algorithms and they obtained different accuracy results.The work presented in [6] used Artificial Immune System (AIS) and resulted in 84.5% classification accuracy.The work in [7] utilized a hybrid Neural Network ANN and fuzzy neural network (FNN) and reached the classification accuracy of 86.8%.On the other hand, [8] developed SAS based software by using neural network ensemble method and obtained 89.01%accuracy in classification.Recently, a research employed an MLP Neural Network by using Back propagation algorithm which classifies the data into 5 categories with 97.5% accuracy, whereas the SVM based system achieved 80.41% accuracy.In the presented study, a Multilayer Perceptron Neural Network (MLPNN) with three layers is employed and compared with Support Vector Machine (SVM).Results indicated that a MLPNN with back propagation was more successful than support vector machine for diagnosing heart disease [1].
In addition to artificial neural network, fuzzy expert systems are also used in MDSS.For Instance a fuzzy expert system was proposed to determine heart disease risk of patient in 2007 and the result of this system was 79% [2].Recently a research designed a fuzzy expert system for heart disease diagnosis, according to the result ob-tained from designed system, it was correct in 94% [9].All these previous studies show the applicability of ANN in this selected area.

Research Algorithms and Concepts
Important concepts, architecture theory, and algorithm for Neural Network and Neuro-Fuzzy are described in this section.

Neural Network Approach
Neural Network (NN) also referred to as Artificial Neural Network (ANN) is a computational model where its functions and methods are based on the structure of the brain.Neural network follows graph topology in which neurons are nodes of the graph and weights are edges of the graph.It consists of so many layers that should be finite in order to decrease time of problem solving.In this paper, neural network is used since it has the potential for supporting medical decision support systems.
In large data sets, it has cost-effective and flexible non-linear modeling since the optimization is easy.In addition, it is accurate in predictive inference.Another important factor is that these models can make knowledge dissemination easier by providing explanation, for instance, using rule extraction or sensitivity analysis [4].ANN has various models, such as Multilayer Perceptron (MLP), RFB and so forth that are different in terms of architecture and training network which will be discussed in the following sub-sections.

Neural Network Architecture
In ANN, neurons can be arranged in various ways and the weights (connection between neurons) can have different patterns which is called neural network architecture.There are different types of architectures, such as feed-forward, feed-back, fully interconnected net, competitive net and so forth.Some of the most important architectures are introduced in [10].Feed-forward architecture can have single or multi layer of weights.In single layer feed-forward net, there is only one interconnected weights while in multi layer feed-forward net, more than one interconnected layers of weights can exist.Figure 1 shows feed-forward multi layer architecture.
Fully recurrent network architecture is the simplest sort of architecture in which every neuron is connected to each other.Simple recurrent network is to somehow like fully recurrent network, except that neurons are not fully connected.Competitive network is the same as single layer feed forward architecture.In addition of all attributes related to single layer feed forward architecture, in competitive network there is connection between outputs.Among aforementioned architecture, feed-forward architecture is the most suitable one in terms of time for a large amount of data.

Multilayer Perceptron (MLP)
In this research, MLP is used as one neural network model since it follows feed-forward architecture and supervised training.Perceptron network has usually a layer of input, a layer of output and one or more hidden layers in between.Figure 2 represents MLP with two hidden layers.The input layer consists of raw data which is patients' information in the heart diagnostic system.In addition, the hidden layers have weights and generate output layer.In other words, MLP aims to map the input to the output using historical data.
MLP uses back propagation as its training algorithm.This algorithm repeats presentation of the input data to the neural network.In each iteration, the output data is compared with the desired one, error is computed and fed back (back propagated) to the network.This feedback is used to modify the weights of neurons.Finally, the desired output will be generated based on iterations [6].

Neuro-Fuzzy Approach
Another model that is used in this work is Neuro-Fuzzy, which is the combination of fuzzy logic and neural networks in order to solve wide variety of real world problems in an effective manner.This combination is for removing the limitation of each model.Since neural networks are good at recognizing patterns and not good at explaining how they achieve their decisions.Fuzzy logic systems that can give inexact reasons, and explain their decisions well but not good at reaching the rules they use to make those decisions [11].The ability to model a problem domain using a linguistic model instead of complex mathematical is the main advantage of using the Neuro-Fuzzy combination [12].Therefore, these techniques are complementary to be used together [13].
In this work, a very famous architecture for Neuro-Fuzzy approach known as Adaptive-Network-based Fuzzy Inference System (ANFIS) is used as introduced in [14].ANFIS can serve as a basis for constructing a set of fuzzy if-then rules with appropriate membership functions to generate the stipulated input-output pairs.ANFIS tool is embedded now in Matlab, therefore, users have to simply type the command "anfisedit" in Matlab command window in order to use this valuable tool.Figure 3 shows the ANFIS architecture, whereas Figure 4 shows the ANFIS procedure.

Automatic Heart Disease Diagnosis System's Design and Implementation
This section highlights all aspects regarding the data set, design, and implementation for the automatic heart disease diagnosis system.

The Cleveland Data Set
It is very obvious that data set is an important aspect for developing this kind of systems.The Cleveland data set is very famous and has been widely used as a benchmark for heart disease diagnosis systems.Therefore, the Cleveland data set for heart diseases is used in this project.
The Cleveland data set contains a total number of 303 instances with 13 medical attributes (factors) that are acquired from heart disease data set of Cleveland [15].Table 1 shows some general information of the Cleveland data set, whereas Table 2 shows a detailed attributes description of the Cleveland data set.
Trestbps Resting blood pressure in mm Hg.

Chol
Serum cholesterol in mg/dl.

Thalach
Maximum heart rate achieved.
Oldpeak ST depression induced by exercise relative to rest.

Ca
Number of major vessels colored by fluoroscopy.
Num "The Disease Diagnosis" field refers to the presence of heart disease in the patient.It is integer valued from 0 (no presence) to 4.Here the H0 is denoting no presences of heart disease and H1, H2, H3, and H4 are presenting the presence of heart disease.
It is important to highlight that the Cleveland data set was randomly divided into two main categories namely: Training and Testing data set, which comprise of 80% and 20% of the total Cleveland data set respectively.
Experiments with the Cleveland data set have concentrated on simply attempting to distinguish presence (values H1, H2, H3, and H4) from absence (value H0).Therefore, two main outputs are identified, where the value H0 means heart disease is absent from the patient, and the values H1, H2, H3, and H4 mean heart disease is present in the patient.Table 3 depicts the distribution of disease records for Neural Network and Neuro-Fuzzy approaches.

System's MATLAB Graphical User Interfaces (GUIs)
The programming language used for developing the automated heart disease diagnosis system is MATLAB, which is a powerful language for data analysis and visualization.There are many programming languages used in data mining.It is important to know the reasons of choosing MATLAB as data mining tool for this paper.The first advantage of using MATLAB is portability that the users will have the same range of basic functions at their disposal.Second advantage is domain specific representations that points out in MATLAB implementation, all data is the form of matrices [16].This allows us a variety of algorithms and it is very helpful.In addition, standard neural networks have got multidimensional data which is hard for the human brain to understand.MATLAB makes this problem easy to deal with by 3D graphs and plots [17].By using MATLAB we can also cluster the data, in which we group the objects that have similar characteristics [18].Therefore, MATLAB is preferred because of its outstanding data calculation and visual graphic representation function [19].
As stated earlier, there are two main systems, whereby the first one is based on ANN and the second one is based on Neuro-Fuzzy.Each system has three main modules namely: Training, Testing, and Case-Based Modules.

Experimental Results and Analysis
As stated earlier, there are two main approaches used to develop the automated heart disease diagnosis system, which are the ANN and Neuro-Fuzzy.Therefore, each system has been experimented and results have been analyzed in order to compare the performance of the two approaches.It is important to highlight that there are two main tests conducted, the first at the training module, where the training data set is tested against the trained Neural Network and Neuro-Fuzzy, and the second at the testing module, where the testing data set is tested against the trained Neural Network and Neuro-Fuzzy.Certain parameters were modified for both systems in order to optimize the systems' performance and acknowledge their effects on the overall systems' performance.Finally, the best combination of parameters are selected and used in the systems for future tests.A third test is conducted, where users could input values for a specific case and classify whether the heart disease is present or absent as shown in Table 4.

Experimental Results for ANN System
Two main parameters have been explored in training the ANN system, which are the maximum number of epochs and number of hidden neurons.Maximum number of epochs ranges from 1000 to 5000 with an increment of 1000, whereas number of hidden neurons ranges from 5 to 15 with an increment of 5. Table 4 shows the obtained results from different combinations of epochs and hidden neurons.
From Table 4, it is clearly found that the ANN system mostly achieved 80% onwards in most combinations of the two parameters.However, it is found that the combination 4000 epochs and 15 hidden neurons achieved the highest accuracy using the training data set, which is 90.74% but did not achieve the highest accuracy using the testing data, which is 85.19%.On the other hand, the combination 5000 epochs and 15 hidden neurons achieved the highest accuracy using the testing data set, which is 87.04% but did not achieve the highest accuracy using the training data, which is 88.43%.
In most systems, the testing data is very important and systems are evaluated on how best they can perform when receiving data from of someone who has not been trained earlier.Therefore, if considering this aspect, the combination of 5000 epochs and 15 hidden neurons is selected since it performs the highest using the testing data set.
It is also seen that the ANN system could successfully classify the user inputs for a specific case, where through the 15 different experiments, the ANN system could classify that data to "Absent" of heart disease, therefore, the case-based module achieved 100% accuracy as far as Table 4 is concerned.

Experimental Results for Neuro-Fuzzy System
Given separate sets of input and output data, "genfis2" parameter generates a Fuzzy Inference System (FIS) structure using fuzzy subtractive clustering.When there is only one output, "genfis2" may be used to generate an initial FIS for ANFIS training by first implementing subtractive clustering on the data.The parameter "gen-fis2" accomplishes this by extracting a set of rules that models the data behavior.
The rule extraction method first uses the MATLAB "subclust" function to determine the number of rules and antecedent membership functions and then uses linear least squares estimation to determine each rule's consequent equations.This function returns an FIS structure that contains a set of fuzzy rules to cover the feature space.Therefore, the "genfis2" is the only parameter that is investigated in this research and it ranges from 0.1 to 1.0 as shown in Table 5.
From Table 5, it is clearly found that the Neuro-Fuzzy system has excellent achievements using training data set, where all values of "genfis2" from 0.1 to 1.0 achieved 100%.However, the Neuro-Fuzzy system could not achieve higher accuracy using the testing data set.The best performance using the testing data set was at 0.5, which is 75.93%.In fact, "0.5" is the benchmark value for "genfis2" parameter.It is also noticed that as we increase the value for the "genfis2", the number of generated rules decreases.
It is also seen that the Neuro-Fuzzy system could not successfully classify all the user inputs for a specific case, where only 6 out of 10 different experiments, the Neuro-Fuzzy system could classify that data to "Absent" of heart disease, and 4 other experiments the Neuro-Fuzzy system failed to successfully classify them.Therefore, the case-based module achieved 60% accuracy as far as Table 5 is concerned.
In most systems, the testing data is very important and systems are evaluated on how best they can perform when receiving data from of someone who has not been trained earlier.Therefore, if considering this aspect, the value for the "genfis2" parameter is fixed at "0.5".

Conclusion and Future Work
This research effort developed two systems based on ANN and Neuro-Fuzzy approaches in order to develop an automatic heart disease diagnosis system.From both Table 4 and Table 5, it is clear that the Neuro-Fuzzy system outperforms the ANN system the training data set, where the accuracy for each system was 100% and 90.74%, respectively.However, using the testing data set, it is clear that the ANN system outperforms the Neuro-Fuzzy system, where the best accuracy for each system was 87.04% and 75.93%, respectively.This system can be used at hospital level by doctors and physicians to classify the patient's heart disease.Future work can be through applying various ANN's architecture and training algorithms for achieving more accurate results.
The process of training the network aims to achieve the expected output by changing the weights in the connections between network layers.There are three sorts of network training as follows: • Supervised Training: In this process, a series of sample inputs are available for the network and the resulted output are compared with expected responses.• Unsupervised Training: This process is used for the time that the output of training input vectors are unknown.• Reinforcement Training: This process shows the correctness of output result.In this paper, supervised training is used since it is based on the Cleveland database, whereby all input and expected output data are available.

Table 1 .
General information of Cleveland data set.

Table 2 .
Attributes' description of Cleveland data set.

Table 3 .
Attributes' description of Cleveland data set.

Table 4 .
Experimental results for ANN system with different combination of parameters.

Table 5 .
Experimental results for neuro-fuzzy system with different values of "genfis2".