public void AnomalyDetectionAlgorithmTrainingTest()
        {
            var listOfStudents = this.GetStudentListForPMI43();
            var normal         = new[] { "2", "13", "6" };
            var anomalies      = new[] { "8", "10" };
            var trainingSets   = TrainingSetsCreator.GenerateTrainingSets(listOfStudents, normal, anomalies);

            var algirithmResults = AnomalyDetectionAlgorithm.RunAlg(
                listOfStudents, trainingSets[0], trainingSets[1], trainingSets[2]);

            Assert.AreEqual(algirithmResults.First(x => x.Key.Key.OpenId == "2").Value, false);
            Assert.AreEqual(algirithmResults.First(x => x.Key.Key.OpenId == "6").Value, false);
            Assert.AreEqual(algirithmResults.First(x => x.Key.Key.OpenId == "13").Value, false);
            Assert.AreEqual(algirithmResults.First(x => x.Key.Key.OpenId == "8").Value, true);
            Assert.AreEqual(algirithmResults.First(x => x.Key.Key.OpenId == "10").Value, true);
        }
        public ActionResult TrainAlg(string[] tsNormal, string[] tsAnomalies)
        {
            var topicId          = (int)HttpContext.Session["TopicId"];
            var studentsAndMarks = this.storage.GetAllStudentListForTraining(topicId);

            TrainingSet[] tr;

            try
            {
                tr = TrainingSetsCreator.GenerateTrainingSets(studentsAndMarks, tsNormal, tsAnomalies);
            }
            catch (Exception)
            {
                HttpContext.Session["ShowError"] = true;
                return(RedirectToAction("TrainTopic", "AnomalyDetection", new { id = (int)HttpContext.Session["TopicId"] }));
            }

            ViewData["SkillTags"] = this.storage.GetTags();
            return(View(AnomalyDetectionAlgorithm.RunAlg(studentsAndMarks, tr[0], tr[1], tr[2])));
        }