added function for calculating information gain