public static double[] FindDistribution(this IEnumerable <Tuple <Instance, double> > source, Feature classFeature)
 {
     if (classFeature.FeatureType != FeatureType.Nominal)
     {
         throw new InvalidOperationException("Cannot find distribution for non-nominal class");
     }
     double[] result = new double[((NominalFeature)classFeature).Values.Length];
     foreach (var tuple in source)
     {
         if (!FeatureValue.IsMissing(tuple.Item1[classFeature]))
         {
             int value = (int)tuple.Item1[classFeature];
             result[value] += tuple.Item2;
         }
     }
     return(result);
 }
        public string ToString(double value)
        {
            string strValue = FeatureValue.IsMissing(value) ? "?" : ValueToString(value);

            return(string.Format("{0}={1}", Name, strValue));
        }