Esempio n. 1
0
        private static List <Question> AnswerQuestions()
        {
            var questions = QuestionsHelper.GetQuestions();

            foreach (var question in questions)
            {
                Console.WriteLine($"{question.Name}:");
                if (question.CategoryOptions != null)
                {
                    for (var i = 1; i <= question.CategoryOptions.Count; i++)
                    {
                        Console.WriteLine($"\t{i}: {question.CategoryOptions.ElementAt(i - 1).Name} ");
                    }
                }
                Console.Write("Answer: ");
                question.AnswerIndex = int.Parse(Console.ReadLine());
            }
            return(questions);
        }
Esempio n. 2
0
        public static void GetMultiplePrediction(int numberOfPredictions)
        {
            var csv         = new CsvReader(File.OpenText(@".\data\german.input.csv"));
            var recordCount = 0;

            csv.Read();
            while (csv.Read() && recordCount < numberOfPredictions)
            {
                var answers = new List <string>();
                for (int i = 0; i < 20; i++)
                {
                    answers.Add(csv.GetField(i));
                }
                recordCount++;
                var answeredQuestions = QuestionsHelper.GetQuestions(answers);
                var result            = InvokeRequestResponseService(answeredQuestions).Result;
                Console.WriteLine("Actual credit risk classification: {0}", CreditRiskDictionary[csv.GetField(20)]);
                Console.WriteLine("Predicted credit risk classification: {0}", CreditRiskDictionary[result.Item1]);
                Console.WriteLine("Probability of risk: {0}", result.Item2);
            }
        }