/// <summary>
 /// Given an instance to classify, scores and returns
 /// score by class.
 /// </summary>
 /// <remarks>
 /// Given an instance to classify, scores and returns
 /// score by class.
 /// NOTE: supports only RVFDatums
 /// </remarks>
 public virtual ClassicCounter <K> ScoresOf(IDatum <K, V> datum)
 {
     if (datum is RVFDatum <object, object> )
     {
         RVFDatum <K, V> vec = (RVFDatum <K, V>)datum;
         if (l2Normalize)
         {
             ClassicCounter <V> featVec = new ClassicCounter <V>(vec.AsFeaturesCounter());
             Counters.Normalize(featVec);
             vec = new RVFDatum <K, V>(featVec);
         }
         ClassicCounter <ICounter <V> > scores = new ClassicCounter <ICounter <V> >();
         foreach (ICounter <V> instance in instances.AllValues())
         {
             scores.SetCount(instance, Counters.Cosine(vec.AsFeaturesCounter(), instance));
         }
         // set entry, for given instance and score
         IList <ICounter <V> > sorted      = Counters.ToSortedList(scores);
         ClassicCounter <K>    classScores = new ClassicCounter <K>();
         for (int i = 0; i < k && i < sorted.Count; i++)
         {
             K      label = classLookup[sorted[i]];
             double count = 1.0;
             if (weightedVotes)
             {
                 count = scores.GetCount(sorted[i]);
             }
             classScores.IncrementCount(label, count);
         }
         return(classScores);
     }
     else
     {
         return(null);
     }
 }