示例#1
0
 private void bulidMarkov()
 {
     Print("_______________________");
     markover = new MarkovChain <string>();
     foreach (var e in extractedUsers)
     {
         foreach (var s in e.Sessions)
         {
             markover.AddTransaction(s.Requests.Select(x => x.RequstedPage).ToList());
         }
     }
     Print("Markov model has been build");
 }
示例#2
0
        public static string Test()
        {
            var r = new MarkovChain <string>();

            r.setEndNodeName("END");
            r.setStartNodeName("START");
            r.AddTransaction("A", "B");
            r.AddTransaction("A", "B");
            r.AddTransaction("A", "B", "C");
            r.AddTransaction("A", "B", "C");
            r.AddTransaction("A", "B", "C", "D");
            r.AddTransaction("A", "B", "C", "E");
            r.AddTransaction("A", "C", "E");
            r.AddTransaction("A", "C", "E");
            r.AddTransaction("A", "B", "D");
            r.AddTransaction("A", "B", "D");
            r.AddTransaction("A", "B", "D", "E");
            r.AddTransaction("B", "C");
            r.AddTransaction("B", "C");
            r.AddTransaction("B", "C", "D");
            r.AddTransaction("B", "C", "E");
            r.AddTransaction("B", "D", "E");

            string res = "";

            foreach (var t in r.GetAllItems())
            {
                res += bulidTestResult(r, t) + "--------------- \r\n";
            }

            res += "\r\n\r\n" + (r.Probability("START", "C"));
            return(res);
        }