AIMA.Core.Learning.Framework.DataSet.getInformationFor C# (CSharp) 메소드

getInformationFor() 공개 메소드

public getInformationFor ( ) : double
리턴 double
        public double getInformationFor()
        {
            String attributeName = specification.getTarget();
            Dictionary<String, int> counts = new Dictionary<String, int>();
            foreach (Example e in examples)
            {

                String val = e.getAttributeValueAsString(attributeName);
                if (counts.ContainsKey(val))
                {
                    counts[val]++;
                }
                else
                {
                    counts.Add(val, 1);
                }
            }

            double[] data = new double[counts.Keys.Count];
            int i = 0;
            foreach(string key in counts.Keys)
            {
                data[i] = counts[key];
                i++;
            }

            data = Util.normalize(data);

            return Util.information(data);
        }