Beispiel #1
0
        public static Session Create(User user, string[] tokens)
        {
            if (!tokens[2].Equals("M"))
                throw new ArgumentException("unexpected type");
            Session session = new Session();

            session.SessionID = UInt64.Parse(tokens[0]);
            session.Day = Byte.Parse(tokens[1]);
            session.User = user;
            switch (tokens[4])
            {
                case "B":
                    session.Switch = SwitchType.Bar;
                    break;
                case "P":
                    session.Switch = SwitchType.Search;
                    break;
                case "H":
                    session.Switch = SwitchType.Hybrid;
                    break;
                case "N":
                    session.Switch = SwitchType.No;
                    break;
                default:
                    Debug.Fail("unexpected switch type: " + tokens[4]);
                    break;
            }
            session.Actions = new List<IUserAction>();
            return session;
        }
Beispiel #2
0
 private static double[] CreateOutput(Session session)
 {
     double[] output = new double[classesCount];
     output[0] = session.Switch == Session.SwitchType.No ? 1 : 0;
     output[1] = session.Switch != Session.SwitchType.No ? 1 : 0;
     return output;
 }
Beispiel #3
0
 private static double[] CreateInput(Session session)
 {
     double[] input = new double[inputSize];
     input[0] = session.FirstClickTime;
     input[1] = session.TotalTimes;
     input[2] = session.MinTimeBetweenQueries;
     input[3] = session.MaxTimeBetweenQueries;
     input[4] = session.AvgMinTimeBetweenClicksInSERP;
     input[5] = session.AvgMaxTimeBetweenClicksInSERP;
     input[6] = session.TotalClicks;
     input[7] = session.TotalQueries;
     input[8] = session.FirstClickPageDuration;
     input[9] = session.FirstClickResultIndex;
     input[10] = session.User.SwitchFreq;
     input[11] = session.User.AvgTimeBeforeFirstSwitch;
     input[12] = session.User.AvgQueriesBeforeFirstSwitch;
     input[13] = session.User.AvgClicksBeforeFirstSwitch;
     input[14] = session.AvgTimeBetweenClicksInSERP;
     input[15] = session.AvgClicksPerQuery;
     input[16] = session.AvgFirstClickResultIndexPerQuery;
     input[17] = session.AvgFirstClickTimePerQuery;
     
     return input;
 }
Beispiel #4
0
 public bool DetectSwitch(Session session)
 {
     double[] output = Run(session);            
     if (output[0] > output[1])
         return false;
     return true;
 }
Beispiel #5
0
 private double[] Run(Session session)
 {
     double[] input = CreateInput(session);
     input = ScaleInput(input);
     return _network.Compute(input);
 }