1 Introduction

Hepatitis is a fatal inflammation of the liver and is a direct threat to millions of human lives. It has five main types: hepatitis A, B, C, D, and E. According to the recent World Health Organization (WHO) data, hepatitis B and C infected people are 2 billion and 360 million, respectively. Only these two types of hepatitis infections (B and C) cause 57% of liver cirrhosis cases and 78% of primary liver cancer (Alshamrani and Osman 2017; World Health Organization 2013).

Hepatitis A and E are usually caused by consumption of contaminated food or water, whereas hepatitis B, C, and D occur due to parenteral contact with diseased body fluids of the infected individuals (Avci 2016). Hepatitis infections cause liver inflammation which may lead to even severe conditions such as cirrhosis and cancer leading to the death of the infected person (Ayaz et al. 2014; Schweitzer et al. 2015).

Hepatitis B is one of the most serious types of viral hepatitis which is transmitted through semen, exposure to infected blood, and other body fluids (Bilal et al. 2014). It can be transmitted to the infant from infected mother at the time of childbirth (Fisicaro et al. 2017). Furthermore, contaminated blood transfusion, use of injection during medical procedures, injective drug use, and careless use of hair and nail cutting instruments are among the risk factors of hepatitis B. Recently, as estimated by WHO, worldwide 0.78 million people die each year due to hepatitis B (Lok et al. 2016; Salman et al. 2016).

Exposure to contaminated hepatitis type C virus (HCV)-infected blood and other infected blood products in the course of medical procedures cause hepatitis C. Approximately, 0.7 million people lose their lives because of this type of hepatitis annually. It is considered the main cause of chronic and acute liver infections. It has been reported recently that around 140 million people have chronic hepatitis infection globally (Ali et al. 2014).

Subjects infected with hepatitis type B are at high risk of type D infection also, and the result of double infection may have even worse outcomes. Hepatitis E virus enters the human body through the intestine and develops acute liver failure, also called fulminant hepatitis. Globally, 20 million infections and 0.56 million hepatitis E-related deaths are reported each year (Norton et al. 2017; World Health Organization 2013).

In the field of medicine, disease diagnosis is regarded as a complicated job (Ahmad et al. 2018; Alshamrani and Osman 2017). Identifying a disease from different features is an intricate and multilayer problem which may lead to false assumption and most probably accompanied by impulsive effects. Hence, the effort to utilize knowledge and experience of numerous medical practitioners and clinical data of the patients stored in databases to assist the diagnosis procedure is counted as a valuable option (Ahmad et al. 2017). To address this issue, we propose a new technique to diagnose hepatitis disease. This technique hybridizes information gain method and adaptive neuro-fuzzy inference system in two stages. In the first stage, information gain reduces the number of features of the preprocessed dataset. It is used to select the most relevant attributes to the disease with respect to weight (using Entropy) which in turns reduces the computation time and increases classification accuracy. While, in the second stage, the selected attributes are fed to ANFIS to diagnose hepatitis disease. This approach is very promising, as compared to the applications reported previously, in terms of reduced computational time, classification complexity, and higher classification accuracy.

2 Literature review

Myriad attempts have been made earlier to diagnose hepatitis using different single and hybrid models. Some of the classification systems used for clinical diagnosis problems are discussed in this section, i.e., Bascil and Temurtas (2011) proposed a multilayer neural network structure and obtained 91.87% classification accuracy. Polat and Güneş (2006) introduced a hybrid approach combining two different techniques (FS-AIRS) to forecast hepatitis disorders and achieved classification accuracy results about 92.59%. Ster and Dobnikar (1996) made several attempts using different techniques such as ASI, MLP-BP, LDA, and FDA and succeeded with 86.4% classification accuracy. Land and Verheggen (2003) applied different methods such as AdaBoost and ANFIS and obtained 57.60% and 59.90% classification accuracy, respectively. Özyıldırım and Yıldırım (2003) used PLM and RBF and obtained 80% classification accuracy. Dogantekin et al. (2009) used LDA-ANFIS and obtained 94.24% classification accuracy. Recently, Prasad et al. (2016) introduced various hybrid methods (rough dataset and machine learning algorithms) for medical diagnosis and obtained 93% accuracy. Liu et al. (2017) presented RFRS a hybrid classification system and obtained 92.59% accuracy.

Performance of the system’s classification should be as high as possible in order to have a real-life system (Ahmad et al. 2017; Cahan and Cimino 2017). Disease diagnosis is considered a significant yet intricate task that requires to be accomplished accurately and efficiently (Alickovic and Subasi 2016). Since hepatitis is a deadly disease and the previous diagnosis methods reported in the literature are not very accurate, we were intrigued to propose a hybrid decision support system using information gain method and ANFIS to provide more accurate classification. We combined two different techniques in which each one has its own significance. Information gain method reduces the dimensionality of the dataset, while ANFIS performs classification.

We used hepatitis dataset to examine the effectiveness of our approach and achieved 95.24% classification accuracy, which proves that our proposed hybrid technique is more successful than the previously applied models and can be utilized as a promising tool for other diseases also.

3 Materials and methods

3.1 Proposed system

In the proposed system, information gain and ANFIS techniques are combined to diagnose hepatitis disorders. Information gain method is defined in the field of machine learning as the term’s goodness criterion (Uğuz 2011). Its purpose in this study is to select quality attributes while deselecting unimportant and redundant attributes from the dataset retrieved from the UCI machine learning repository. In the output, it provides a set of attributes whose ranking values are higher than the rest, which is then provided as input to ANFIS to train and test the recommended system. The first stage of the proposed system includes data retrieval and feature extraction. The second stage is called classification stage as shown in the block diagram (Fig. 1).

Fig. 1
figure 1

Block diagram of the proposed system

3.2 Information gain and WEKA

In datasets, every attribute has a specific rank and importance, based on which machine can learn about a certain problem (Witten et al. 2016). Information gain filter “InfoGainAttributeVal” attribute evaluator was applied with a searching method “Ranker-T-1” on hepatitis dataset to achieve the result of information gain method. This measure is associated with the reduction in entropy in the training set when the value of the feature is known. The algorithms calculate the worth of attribute by computing the information gain according to classification. To approximate the quality of each attribute, the information gain method is implied that uses entropy by means of estimating the difference between prior entropy and post entropy (Ashraf et al. 2010).

The prior entropy of X is given in Eq. (1), where X and Y are considered discrete variables:

$$ - \sum \limits_{X} P( X )\log_{2} P( X). $$
(1)

Here P(X) represents the probability function of X. The conditional entropy of X given by post entropy Y will be as in Eqs. (2) and (3).

$$ {\text{Entropy}}(X|Y) = - \mathop \sum \limits_{V} P\left( Y \right){\text{Entropy}}(X|Y), $$
(2)
$$ = - \mathop \sum \limits_{Y} P\left( Y \right){\text{Entropy}}(X|Y)\log_{2} P(X|Y). $$
(3)

The information gain defined in Eqs. (4) and (5) and represented with InfoGain(X;Y):

$$ {\text{InfoGain}}\left( {X;Y} \right) = {\text{Entropy}}\left( X \right){-}{\text{Entropy}}\left( {X|Y} \right), $$
(4)
$$ {\text{InfoGain}}\left( {X;Y} \right) = - \mathop \sum \limits_{X} P\left( X \right)\log_{2} P\left( X \right) - \mathop \sum \limits_{Y} ( - P\left( Y \right) \times \mathop \sum \limits_{X} P\left( {X|Y} \right)\log_{2} P(X|Y)). $$
(5)

In this study, we used the Waikato Environment for Knowledge Analysis (WEKA) to compute information gain. WEKA is written in Java language and is an open-source machine learning software that provides an environment for the calculation of information gain (Frank et al. 2004; Hall et al. 2009). It comprises of various machine learning and data-mining methods for data processing, visualization, association, classification, clustering, and regression. We propose that combining information gain and adaptive neuro-fuzzy inference system for the diagnosis of hepatitis can be a potential and efficient alternative for the physician to decide about the infection.

3.3 Adaptive neuro-fuzzy inference system

ANFIS (adaptive neuro-fuzzy inference system) is the combination of neural network and fuzzy inference system. To train a hybrid learning algorithm, ANFIS uses least square estimate (LSE) with gradient descent method (Adeli et al. 2013; Jang 1993, 1996). One cycle of hybrid learning algorithm consists of two passes: forward and backward pass. LSE method is used to identify consequent parameters, while a signal travels until layer 4 in the forward pass. Gradient descent then performs updating of premise parameters, whereas error propagates backward. In order to achieve the lowest possible error, the same process is repeated again and again (Kalaiselvi and Nasira 2014). To understand ANFIS architecture, suppose a fuzzy system with two input x and y. The fuzzy system comprises of two Sugeno fuzzy rules:

$$ {\text{IF}}\;x\;{\text{is}}\;A_{1} \;{\text{AND}}\;y\;{\text{is}}\;B_{1} ,\;{\text{THEN}}\;f_{1} = p_{1} x + q_{1} y + r_{1} , $$
(6)
$$ {\text{IF}}\;x\;{\text{is}}\;A_{2} \;{\text{AND}}\;y\;{\text{is}}\;B_{2} ,\;{\text{THEN}}\;f_{2} = p_{2} x + q_{2} y + r_{2} . $$
(7)

In above rules 06 and 07, given inputs are indicated by x and y, fuzzy sets by Ai and Bi, output specified by fuzzy rules indicated by fi and design parameters are denoted by pi, qi, and ri. ANFIS structure is shown in Fig. 2. There are five layers, and each contains a different number of nodes. Nodes in the same layer have the same functions.

Fig. 2
figure 2

ANFIS architecture

Layer 1: Each square node \( i \) represented by Ai in layer1 has a node function as described in Eq. (8).

$$ o_{i}^{1} = \mu_{{A_{i} }} \left( x \right). $$
(8)

In Eq. (8), x represents input to node \( i \). Here \( o_{i}^{1} \) denotes Ai membership function. It specifies the degree to which x satisfies the Ai quantifier. \( \mu_{{A_{i} }} \left( x \right) \) is a generalized bell-shaped function as defined in Eq. (9). Here ai and ci are premise parameters.

$$ \mu_{{A_{i} }} \left( x \right) = \exp \left[ { - \left( {\frac{{x - c_{i} }}{{a_{i} }}} \right)^{2} } \right] $$
(9)

Layer2: Nodes are represented by circles and labeled with “π” in Fig. 2. It takes layer1’s outputs as input and multiplies them to produce weight. The output of layer2 indicates the firing strength of the rules.

$$ \bar{w} = \mu_{{A_{i} }} (x) \times \mu_{{B_{i} }} (x),\quad i = 1,2 $$
(10)

Layer3: It consists of circled nodes labeled with “N” compute implication of each output member function by normalizing weight of a certain node comparing with the weights of other nodes.

$$ \bar{w} = \frac{{w_{i} }}{{\mathop \sum \nolimits_{j} w_{j} }}\quad i = 1,2.\quad j = 2 $$
(11)

Layer4: This layer is represented by square nodes. Equation (12) describes how to write a linear format for the output of a rule based on Sugeno inference system. In this equation, ri represents bias and pi and qi indicates consequent parameters.

$$ o_{i}^{4} = \bar{w}_{i} f_{i} = \bar{w}_{i} (p_{i} x + q_{i} y + r_{i} ) $$
(12)

Layer5: This is the aggregation layer. It computes the summation of rules and produces a single output.

$$ o_{i}^{5} = {\text{output}} = \mathop \sum \limits_{i} \bar{w}_{i} f_{i} = \frac{{\mathop \sum \nolimits_{i} w_{i} f_{i} }}{{\mathop \sum \nolimits_{i} w_{i} }} $$
(13)

3.4 Data retrieval and preprocessing

Hepatitis dataset provided by Gail Gong (collected from Carnegie-Mellon University) was acquired from the UCI machine learning repository (Alshamrani and Osman 2017). The reason behind using this dataset was to compare our experimental results with previously used techniques for hepatitis diagnosis. The dataset comprises 155 records of hepatitis patients with 19 attributes for each patient. Table 1 shows attributes of hepatitis dataset and its values provided by the repository. There are two types of records in the class attributes of this dataset based on the condition of the patient, i.e., live class (represented with 1) and die class (represented as 0). The dataset contains 123 (79.4%) records of “live” class and 32 (20.6%) records of “die” class as shown in Table 2.

Table 1 Attributes of hepatitis disease dataset
Table 2 Class distribution

Hepatitis dataset contains a matrix of 155 by 19, where (155) rows denote the number of patients (records) and columns (19) denote the number of experiments. In this work, experiments are called as attributes. The dataset was preprocessed, and attribute values were normalized to make it suitable for the mining process.

4 Experimental results

Experiments were performed on hepatitis dataset to examine the effectiveness of our proposed technique. The dataset was acquired from the UCI machine learning repository, and attribute values of the dataset were normalized for the next phases of the approach as discussed in Sect. 3.4. After preprocessing the dataset went through two phases. In the first phase of the proposed technique, the dimension of the hepatitis dataset was reduced using information gain method. Information gain filter “InfoGainAttributeVal” was applied with a searching method Ranker-T-1 on hepatitis dataset to achieve the results (details Sect. 3.2).

Information gain is one of the popular approaches for reducing the number of features (Uğuz 2011). It aims at ranking the subset of features based on high information gain entropy in decreasing order. In this phase, the effects of individual features ranking operation by the IG method on classifier performance are examined. Waikato Environment for Knowledge Analysis (WEKA) application version 3.8 was used for the said attribute selection of hepatitis dataset. Out of 19 attributes, eight attributes were selected which showed the highest ranking and were recommended to be applied as an input for the ANFIS system. Sample attributes with ranking values are shown in Fig. 3. The dataset with selected attributes was divided into two sets for the final phase, i.e., training and testing set. Training set shared 35% and testing set shared 65% of the actual dataset’s sample size.

Fig. 3
figure 3

Information gain ranking of selected attributes

In the second part, we applied the Sugeno fuzzy inference system to construct a fuzzy inference system (FIS). As shown in Fig. 4, FIS maps attributes to attributes membership functions (MF), attributes MP maps to rules, rules maps to output, output maps to output MF, and the output MP to output; which is a single-valued output.

Fig. 4
figure 4

Fuzzy inference system structure

ANFIS is a hybrid of two intelligent system models. It combines the low-level computational power of a neural network with the high-level reasoning capability of a fuzzy inference system. This means that it is combining the best aspects of the two technologies while limiting the drawbacks (Nazmy et al. 2010).

The specific advantages of ANFIS hybrid system are:

  • ANFIS uses the neural network’s ability to classify data and find patterns.

  • It then develops a fuzzy expert system that is more transparent to the user and also less likely to produce memorization errors than a neural network.

  • Furthermore, ANFIS keeps the advantages of a fuzzy expert system, while removing (or at least reducing) the need for an expert.

In the proposed experimental study, eight inputs (y1, y2, y3, y4, y5, y6, y7, y8) were provided to ANFIS which produced one output (z). The expression given below is a rule set for first-order Sugeno fuzzy model with base fuzzy if–then rules.

If y1H1 and y2G1 and y3F1 and y4E1 and y5D1 and y6C1 and y7B1 and y8A1, then

$$ f_{1} = ky_{1} + kky_{2} + my_{3} + mmy_{4} + ny_{5} + nny_{6} + py_{7} + ppy_{8} + u $$
(14)

Linear output parameters are represented by k, kk, m, mm, n, nn, p, pp, u in expression (14). Structure of the proposed approach is given in Fig. 5. Figure 6 represents MATLAB ANFIS structure.

Fig. 5
figure 5

Structure of the proposed approach

Fig. 6
figure 6

ANFIS structure on MATLAB

In order to evaluate the classification accuracy and verify the validity of our proposed technique, we used k-fold cross-validation approach. The value of k in this study was set to 10. The classification accuracy for the information gain-ANFIS was found to be 95.24% for hepatitis disease.

4.1 Specificity and sensitivity analysis

Specificity and sensitivity of information gain-ANFIS were calculated for the exact values of hepatitis diagnosis. Equations (15) and (16) are used to calculate the sensitivity and specificity (Ashraf et al. 2010; Dogantekin et al. 2009).

$$ {\text{Sensitivity}} = \frac{{{\text{TP}}\left( {{\text{true}}\;{\text{positive}}} \right)}}{{{\text{TP}}\left( {{\text{true}}\;{\text{positive}}} \right) + {\rm {FN}}\left( {{\text{false}}\;{\text{negative}}} \right)}}\left( \% \right) $$
(15)
$$ {\text{Specificity}} = \frac{{{\text{TN}}\left( {{\text{true}}\;{\text{negative}}} \right)}}{{{\text{FP}}\left( {{\text{false}}\;{\text{postive}}} \right) + {\text{TN}}\left( {{\text{true}}\;{\text{negative}}} \right)}}\left( \% \right) $$
(16)

In Eqs. (15) and (16), TP (true positive) indicates that according to the automatic clinician’s optic nerve diagnosis, the input was considered “die”. While true negative (TN) represents that input was considered “live” and was also labeled as “live” by the automatic clinicians. False positive (PF) indicates that input was labeled as “live” but was considered “die” by the automatic clinicians, and false negative (FN) shows that according to automatic clinicians’ input was considered as “live” with an optic nerve diagnosis.

The values obtained using specificity and sensitivity analysis for information gain (IG)-ANFIS diagnosis system were 91.7% and 96.17%, respectively.

4.2 Classification accuracy

Classification accuracy for the proposed approach was measured with the help of Eq. (17).

$$ {\text{diag-accuracy}} \left( A \right) = \frac{{\mathop \sum \nolimits_{i - 1}^{\left| A \right|} \,{\text{assess}}\left( {a_{i} } \right)}}{\left| A \right|},\quad a_{i} \in A $$
(17)
$$ {\text{assess}} \left( a \right) = \left\{ {\begin{array}{*{20}l} {1,} \hfill & \quad {{\text{if}}\;{\text{classify}}\left( a \right) = a \cdot c} \hfill \\ {0,} \hfill &\quad {{\text{otherwise}},} \hfill \\ \end{array} } \right. $$

In Eq. (17), “A” represents test set of data items to be classified, ai ∊ A; \( a \cdot c \) indicates item “a” class and classification of ai by ANFIS classifier returns class (ai). The classification accuracy value obtained using information gain-ANFIS method was 92.24%.

The results of information gain-ANFIS for hepatitis are compared with earlier methods. Classification accuracies of information gain-ANFIS system and other previous hepatitis diagnosis systems are given in Table 3.

Table 3 Classification accuracies obtained using hepatitis diagnosis systems

5 Discussion and conclusion

In this paper, we proposed a novel hybrid medical diagnosis system which combines information gain and ANFIS method to diagnose hepatitis disease. Attributes were reduced using information gain to an optimal number and then fed the novel set of attributes to the adaptive neuro-fuzzy inference system (ANFIS) to diagnose hepatitis disorders. We got the promising result of classification accuracy, specificity, and sensitivity through the proposed approach which was 95.24%, 91.7%, and 96.17%, respectively. Comparison with earlier diagnosing methods is shown in Table 3 which proves that the proposed system is better than the previous diagnosis methods reported in the literature.

In the future, we will further improve this method to reduce the time of computation, increase the accuracy of the system and apply it to more datasets. In addition, a desktop application can be made for easy and efficient hepatitis diagnosis.