Ejemplo n.º 1
0
        private static void ShowAccordIntermediateData(IDataView input, LogisticRegression accordModel)
        {
            var convertedInput = IDataViewToAccord(input).inputs;

            bool[] lrOutput        = accordModel.Decide(convertedInput);
            var    lrScore         = accordModel.Scores(convertedInput);
            var    lrProbability   = accordModel.Probabilities(convertedInput);
            var    inputEnumerable = mlContext.Data.CreateEnumerable <IDataViewWrapper>(input, true);

            sw.WriteLine("Label\tScore\tProbability\tPrediction");
            int count = 0;

            foreach (IDataViewWrapper pp in inputEnumerable)
            {
                int    label       = pp.Label ? 1 : 0;
                int    prediction  = lrOutput[count] ? 1 : 0;
                double score       = lrScore[count][1];
                double probability = lrProbability[count][1];
                sw.WriteLine("{0}\t{1}\t{2}\t{3}", label, score, probability, prediction);
                count++;
            }
            sw.Flush();
        }