public void AnomalyDetectionAlgorithmAccuracy()
        {
            var algObject = new AnomalyDetectionAlgorithm();

            algObject.SetAccuracy(null);

            Assert.AreEqual(algObject.GetAccuracy(), null);
        }
Пример #2
0
        /// <summary>
        /// Train and run anomaly detection algorithm for passes students.
        /// </summary>
        /// <param name="studentsAndMarks">all students, that we want to check</param>
        /// <param name="trainingSet1">Training set</param>
        /// <param name="trainingSet2Normal">Cross validation set with only normal records</param>
        /// <param name="trainingSet2Anomalies">Cross validation set with inly anomalies records</param>
        /// <returns></returns>
        public static IEnumerable <KeyValuePair <KeyValuePair <User, double[]>, bool> > RunAlg(IEnumerable <KeyValuePair <User, double[]> > studentsAndMarks, TrainingSet trainingSet1, TrainingSet trainingSet2Normal, TrainingSet trainingSet2Anomalies)
        {
            var train   = new AnomalyDetectionAlgorithm();
            var formula = train.TrainAlgorithm(trainingSet1, trainingSet2Normal, trainingSet2Anomalies);

            return((from studentAndMark in studentsAndMarks
                    let isAnomaly = formula.IsAnomaly(studentAndMark.Value)
                                    select new KeyValuePair <KeyValuePair <User, double[]>, bool>(studentAndMark, isAnomaly)).ToList());
        }
Пример #3
0
        // For demo

        public static IEnumerable<KeyValuePair<KeyValuePair<User, double[]>, bool>> runAlg(IEnumerable<KeyValuePair<User, double[]>> studentsAndMarks, TrainingSet trainingSet1, TrainingSet trainingSet2Normal, TrainingSet trainingSet2Anomalies)
        {            
            AnomalyDetectionAlgorithm train = new AnomalyDetectionAlgorithm();
            var formula = train.trainAlgorithm(trainingSet1, trainingSet2Normal, trainingSet2Anomalies);
            List<KeyValuePair<KeyValuePair<User, double[]>, bool>> res = new List<KeyValuePair<KeyValuePair<User, double[]>, bool>>();
            foreach (KeyValuePair<User, double[]> studentAndMark in studentsAndMarks)
            {
                bool isAnomaly = formula.isAnomaly(studentAndMark.Value);

                res.Add(new KeyValuePair<KeyValuePair<User, double[]>, bool>(studentAndMark, isAnomaly));
            }

            return res;
        }
Пример #4
0
        // For demo

        public static IEnumerable <KeyValuePair <KeyValuePair <User, double[]>, bool> > runAlg(IEnumerable <KeyValuePair <User, double[]> > studentsAndMarks, TrainingSet trainingSet1, TrainingSet trainingSet2Normal, TrainingSet trainingSet2Anomalies)
        {
            AnomalyDetectionAlgorithm train = new AnomalyDetectionAlgorithm();
            var formula = train.trainAlgorithm(trainingSet1, trainingSet2Normal, trainingSet2Anomalies);
            List <KeyValuePair <KeyValuePair <User, double[]>, bool> > res = new List <KeyValuePair <KeyValuePair <User, double[]>, bool> >();

            foreach (KeyValuePair <User, double[]> studentAndMark in studentsAndMarks)
            {
                bool isAnomaly = formula.isAnomaly(studentAndMark.Value);

                res.Add(new KeyValuePair <KeyValuePair <User, double[]>, bool>(studentAndMark, isAnomaly));
            }

            return(res);
        }
Пример #5
0
        /// <summary>
        /// Train and run anomaly detection algorithm for passes students.
        /// </summary>
        /// <param name="studentsAndMarks">all students, that we want to check</param>
        /// <param name="trainingSet1">Training set</param>
        /// <param name="trainingSet2Normal">Cross validation set with only normal records</param>
        /// <param name="trainingSet2Anomalies">Cross validation set with inly anomalies records</param>
        /// <returns></returns>
        public static IEnumerable<KeyValuePair<KeyValuePair<User, double[]>, bool>> RunAlg(IEnumerable<KeyValuePair<User, double[]>> studentsAndMarks, TrainingSet trainingSet1, TrainingSet trainingSet2Normal, TrainingSet trainingSet2Anomalies)
        {            
            var train = new AnomalyDetectionAlgorithm();
            var formula = train.TrainAlgorithm(trainingSet1, trainingSet2Normal, trainingSet2Anomalies);

            return (from studentAndMark in studentsAndMarks
                    let isAnomaly = formula.IsAnomaly(studentAndMark.Value)
                    select new KeyValuePair<KeyValuePair<User, double[]>, bool>(studentAndMark, isAnomaly)).ToList();
        }