Ejemplo n.º 1
0
        /// <summary>
        ///     Notuję informację o wynikach klasyfikacji
        /// </summary>
        /// <param name="session">Sprawdzana sesja</param>
        public void CalculateQuantities(TestedSession session)
        {
            if (session.RealType == SessionTypes.Human && session.PredictedType == session.RealType)
            {
                CorrectlyAsHuman++;
            }
            else if (session.RealType == SessionTypes.Robot && session.PredictedType == session.RealType)
            {
                CorrectlyAsRobot++;
            }
            else if (session.RealType == SessionTypes.Human &&
                     session.PredictedType == SessionTypes.Robot)
            {
                WronglyAsRobot++;
            }
            else if (session.RealType == SessionTypes.Robot &&
                     session.PredictedType == SessionTypes.Human)
            {
                WronglyAsHuman++;
            }

            if (session.DetectionMethodUsed == DetectionType.Offline)
            {
                SumOfflineDetections++;
            }
            else if (session.DetectionMethodUsed == DetectionType.Online)
            {
                SumOnlineDetections++;
            }
        }
Ejemplo n.º 2
0
 public void AddSession(TestedSession session)
 {
     Sessions.Add(session);
     if (session.RealType == SessionTypes.Robot)
     {
         RobotCount++;
     }
     else if (session.RealType == SessionTypes.Human)
     {
         HumanCount++;
     }
     else
     {
         UnknownCount++;
     }
 }
Ejemplo n.º 3
0
        private void LoadTestDataset(string[] textLines)
        {
            var thisGroup = new TestedGroup {
                GivenName = "Plik testowy"
            };

            foreach (var line in textLines)
            {
                var session  = new TestedSession();
                var requests = line.Split();
                requests = requests.Where(x => !string.IsNullOrEmpty(x)).ToArray();

                session.NumberOfRequests = requests.Length - 1;

                if (requests[0] == "R")
                {
                    session.RealType = SessionTypes.Robot;
                }
                else if (requests[0] == "H")
                {
                    session.RealType = SessionTypes.Human;
                }

                for (var i = 1; i < requests.Length; i++)
                {
                    var currentRequest = new Request();
                    session.AddRequest(requests[i]);

                    var req2 = requests[i].First().ToString().ToUpper() + requests[i].Substring(1);
                    currentRequest.NameType = req2;

                    thisGroup.AddUniqueRequest(currentRequest);
                }

                thisGroup.AddSession(session);
                thisGroup.UniqueRequest.Sort((x, y) =>
                                             string.Compare(x.NameType, y.NameType, StringComparison.Ordinal));
            }

            StoreGroup(thisGroup);
        }