private void DisplayResults(TestedGroup testedGroup) { if (MainScreenContent.GetType() != typeof(PresentationScreenControl)) { MainScreenContent = new PresentationScreenControl(new PresentationScreenViewModel()); } var mainContentViewModel = (PresentationScreenViewModel)MainScreenContent.DataContext; mainContentViewModel.ContentPresented = testedGroup.AsResultsControl(); mainContentViewModel.PerentViewModel = this; mainContentViewModel.HasResultsShown = true; }
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); }
/// <summary> /// Przeprowadza ocenę sesji po każdym nowym żądaniu /// </summary> /// <param name="listOfDtmc">DTMC na podstawie których zostanie dokonana ocena</param> public void PerformOnlineDetection(List <DtmcGroup> listOfDtmc, TestedGroup myGroup) { if (Requests.Count == 1) { Rresult = 0; Hresult = 0; } foreach (var dtmc in listOfDtmc) { if (Requests.Count == 1) { if (dtmc.Sessions[0].RealType == SessionTypes.Robot) { Rresult += GetStartChanceValue(dtmc); } else { Hresult += GetStartChanceValue(dtmc); } } if (dtmc.Sessions[0].RealType == SessionTypes.Robot) { Rresult += GetLogPr(dtmc, Requests.Count - 1); } else { Hresult += GetLogPr(dtmc, Requests.Count - 1); } } // Przepracowano k-sesji if (Requests.Count >= K) { float d = (float)Math.Log(Rresult / Hresult); if (Math.Abs(d) < myGroup.Delta) { } else if (d >= 0) { PredictedType = SessionTypes.Robot; DetectionMethodUsed = DetectionType.Online; } else if (d < 0) { PredictedType = SessionTypes.Human; DetectionMethodUsed = DetectionType.Online; } } if (Requests.Count == NumberOfRequests && !WasClassified) { PerformOfflineDetection(listOfDtmc); } if (PredictedType == SessionTypes.Human || PredictedType == SessionTypes.Robot) { WasClassified = true; } }