The ChiMerge algorithm is initialized by first sorting the training examples according to their value for the attribute being discretized and then constructing the initial discretization, in which each example is put into its own interval. Initially, if two adjacent intervals have a very similar distribution of classes, then the intervals can be merged. In Chi-Merge, each distinct value of a numerical attribute is considered to be one interval. Then X² tests are performed for every pair of adjacent intervals and adjacent intervals with least X² values are merged together. This merging process proceeds recursively, until a predefined stopping criterion is met i.e. until 2 values of all adjacent pairs exceeds a threshold or a predefined no. of intervals has reached. The threshold is determined by the significance level and degrees of freedom = number of classes -1