public virtual void InitMC <F>(IProbabilisticClassifier <L, F> classifier, GeneralDataset <L, F> data)
        {
            //if (!(gData instanceof Dataset)) {
            //  throw new UnsupportedOperationException("Can only handle Datasets, not "+gData.getClass().getName());
            //}
            //
            //Dataset data = (Dataset)gData;
            IPriorityQueue <Pair <int, Pair <double, bool> > > q = new BinaryHeapPriorityQueue <Pair <int, Pair <double, bool> > >();

            total         = 0;
            correct       = 0;
            logLikelihood = 0.0;
            for (int i = 0; i < data.Size(); i++)
            {
                IDatum <L, F> d            = data.GetRVFDatum(i);
                ICounter <L>  scores       = classifier.LogProbabilityOf(d);
                L             guess        = Counters.Argmax(scores);
                L             correctLab   = d.Label();
                double        guessScore   = scores.GetCount(guess);
                double        correctScore = scores.GetCount(correctLab);
                int           guessInd     = data.LabelIndex().IndexOf(guess);
                int           correctInd   = data.LabelIndex().IndexOf(correctLab);
                total++;
                if (guessInd == correctInd)
                {
                    correct++;
                }
                logLikelihood += correctScore;
                q.Add(new Pair <int, Pair <double, bool> >(int.Parse(i), new Pair <double, bool>(guessScore, bool.ValueOf(guessInd == correctInd))), -guessScore);
            }
            accuracy = (double)correct / (double)total;
            IList <Pair <int, Pair <double, bool> > > sorted = q.ToSortedList();

            scores    = new double[sorted.Count];
            isCorrect = new bool[sorted.Count];
            for (int i_1 = 0; i_1 < sorted.Count; i_1++)
            {
                Pair <double, bool> next = sorted[i_1].Second();
                scores[i_1]    = next.First();
                isCorrect[i_1] = next.Second();
            }
        }
        public virtual double Score <F>(IClassifier <L, F> classifier, GeneralDataset <L, F> data)
        {
            IList <L> guesses = new List <L>();
            IList <L> labels  = new List <L>();

            for (int i = 0; i < data.Size(); i++)
            {
                IDatum <L, F> d     = data.GetRVFDatum(i);
                L             guess = classifier.ClassOf(d);
                guesses.Add(guess);
            }
            int[] labelsArr = data.GetLabelsArray();
            labelIndex = data.labelIndex;
            for (int i_1 = 0; i_1 < data.Size(); i_1++)
            {
                labels.Add(labelIndex.Get(labelsArr[i_1]));
            }
            labelIndex = new HashIndex <L>();
            labelIndex.AddAll(data.LabelIndex().ObjectsList());
            labelIndex.AddAll(classifier.Labels());
            int numClasses = labelIndex.Size();

            tpCount  = new int[numClasses];
            fpCount  = new int[numClasses];
            fnCount  = new int[numClasses];
            negIndex = labelIndex.IndexOf(negLabel);
            for (int i_2 = 0; i_2 < guesses.Count; ++i_2)
            {
                L   guess      = guesses[i_2];
                int guessIndex = labelIndex.IndexOf(guess);
                L   label      = labels[i_2];
                int trueIndex  = labelIndex.IndexOf(label);
                if (guessIndex == trueIndex)
                {
                    if (guessIndex != negIndex)
                    {
                        tpCount[guessIndex]++;
                    }
                }
                else
                {
                    if (guessIndex != negIndex)
                    {
                        fpCount[guessIndex]++;
                    }
                    if (trueIndex != negIndex)
                    {
                        fnCount[trueIndex]++;
                    }
                }
            }
            return(GetFMeasure());
        }