AIMA.Core.Learning.Learners.DecisionTreeLearner.chooseAttribute C# (CSharp) Method

chooseAttribute() private method

private chooseAttribute ( DataSet ds, List attributeNames ) : String
ds AIMA.Core.Learning.Framework.DataSet
attributeNames List
return String
        private String chooseAttribute(DataSet ds, List<String> attributeNames)
        {
            double greatestGain = 0.0;
            String attributeWithGreatestGain = attributeNames[0];
            foreach (String attr in attributeNames)
            {
                double gain = ds.calculateGainFor(attr);
                if (gain > greatestGain)
                {
                    greatestGain = gain;
                    attributeWithGreatestGain = attr;
                }
            }

            return attributeWithGreatestGain;
        }