Exemplo n.º 1
0
        public void EstimatePersonLocation_DataFromAyala_ReturnsCorrectFinalSee()
        {
            LocationEstimator locationEstimator = new LocationEstimator(_questionLoader, _answerSheetLoader);
            const int maxNumQuestions = 24;
            List<QuestionInfo> questionHistory = locationEstimator.EstimatePersonLocation(maxNumQuestions);

            double estimatedSee = (double)questionHistory.Last().SEE;
            Assert.IsTrue(Math.Abs(estimatedSee - .192) < Tolerance);
        }
Exemplo n.º 2
0
        public void EstimatePersonLocation_DataFromAyala_ReturnsCorrectFinalQuestion()
        {
            LocationEstimator locationEstimator = new LocationEstimator(_questionLoader, _answerSheetLoader);
            const int maxNumQuestions = 24;
            List<QuestionInfo> questionHistory = locationEstimator.EstimatePersonLocation(maxNumQuestions);

            int finalQuestion = questionHistory.Last().Question.QuestionNumber;
            Assert.IsTrue(finalQuestion == 205);
        }
Exemplo n.º 3
0
        public void EstimatePersonLocation_DataFromAyala_ReturnsCorrectFinalQuestion()
        {
            CATParameters       catParameters     = GetDefaultCatParameters();
            LocationEstimator   locationEstimator = new LocationEstimator(_textQuestionLoader, _textAnswerSheetLoader, catParameters);
            List <QuestionInfo> questionHistory   = locationEstimator.EstimatePersonLocation();

            string finalQuestion = questionHistory.Last().Question.QuestionLabel;

            Assert.IsTrue(Convert.ToInt32(finalQuestion) == 205);
        }
Exemplo n.º 4
0
        public void EstimatePersonLocation_DataFromAyala_ReturnsCorrectFinalInfo()
        {
            CATParameters       catParameters     = GetDefaultCatParameters();
            LocationEstimator   locationEstimator = new LocationEstimator(_textQuestionLoader, _textAnswerSheetLoader, catParameters);
            List <QuestionInfo> questionHistory   = locationEstimator.EstimatePersonLocation();

            double estimatedInformation = (double)questionHistory.Last().Information;

            Assert.IsTrue(Math.Abs(estimatedInformation - .901) < Tolerance);
        }
Exemplo n.º 5
0
        public void EstimatePersonLocation_CompletesAnswerSheet4()
        {
            try
            {
                LocationEstimator locationEstimator = new LocationEstimator(_questionLoader, _answerSheetLoader4);
                List<QuestionInfo> questionHistory = locationEstimator.EstimatePersonLocation(24);

                Assert.IsTrue(true);
            }
            catch (Exception e)
            {
                Assert.IsTrue(false);
            }
        }
Exemplo n.º 6
0
        public void EstimatePersonLocation_CompletesAnswerSheet2()
        {
            try
            {
                CATParameters       catParameters     = GetDefaultCatParameters();
                LocationEstimator   locationEstimator = new LocationEstimator(_textQuestionLoader, _textAnswerSheetLoader2, catParameters);
                List <QuestionInfo> questionHistory   = locationEstimator.EstimatePersonLocation();

                Assert.IsTrue(true);
            }
            catch (Exception)
            {
                Assert.IsTrue(false);
            }
        }
        private static ScoringOutput GetScores(List <string> scaleNames, List <ItemInformation> itemInformationList, List <string> personNames, List <UserAnswers> answersInput,
                                               CATParameters catParameters)
        {
            List <ScoreDetails>         scores           = new List <ScoreDetails>();
            List <List <QuestionInfo> > questionInfoList = new List <List <QuestionInfo> >();

            foreach (var scaleName in scaleNames)
            {
                List <ItemInformation> itemInfoForScale = itemInformationList.Where(x => x.ScaleName.Equals(scaleName)).ToList();
                IQuestionLoader        questionLoader   = new ExcelQuestionLoader(itemInfoForScale, catParameters.MistakeProbability);
                foreach (var personName in personNames)
                {
                    UserAnswers        personAnswers     = answersInput.Single(x => x.PersonName.Equals(personName));
                    ScaleAnswers       answers           = personAnswers.ScaleAnswers.Single(x => x.ScaleName.Equals(scaleName));
                    IAnswerSheetLoader answerSheetLoader = new ExcelAnswerSheetLoader(answers);

                    LocationEstimator   locationEstimator = new LocationEstimator(questionLoader, answerSheetLoader, catParameters);
                    List <QuestionInfo> output            = locationEstimator.EstimatePersonLocation();
                    questionInfoList.Add(output);

                    ScoreDetails scoreDetails = new ScoreDetails()
                    {
                        PersonName = personName,
                        ScaleName  = scaleName,
                        Score      = (double)output.Last().ThetaEstimate
                    };
                    scores.Add(scoreDetails);
                }
            }

            ScoringOutput scoringOutput = new ScoringOutput()
            {
                FirstPersonQuestionInfo = questionInfoList.First(),
                ScoreDetails            = scores
            };

            return(scoringOutput);
        }
Exemplo n.º 8
0
 public void EstimatePersonLocation_BisectionSolverFailing()
 {
     CATParameters       catParameters     = GetDefaultCatParameters();
     LocationEstimator   locationEstimator = new LocationEstimator(_textQuestionLoader2, _textAnswerSheetLoader4, catParameters);
     List <QuestionInfo> x = locationEstimator.EstimatePersonLocation();
 }
Exemplo n.º 9
0
 public void EstimatePersonLocation_CompletesAnswerSheet3()
 {
     CATParameters       catParameters     = GetDefaultCatParameters();
     LocationEstimator   locationEstimator = new LocationEstimator(_textQuestionLoader, _textAnswerSheetLoader, catParameters);
     List <QuestionInfo> questionHistory   = locationEstimator.EstimatePersonLocation();
 }