Example #1
0
        public double Distance(IDistancable t)
        {
            Session s = t as Session;

            if (s == null)
            {
                throw new Exception("The Argument must be of the type 'Session' only");
            }

            double dis = 0;

            if (s.User.Gender != User.Gender)
            {
                dis += 1;
            }
            if (s.CountryCode != CountryCode)
            {
                dis += 1;
            }
            if (s.Browser != Browser)
            {
                dis += 1;
            }
            if (s.OperatingSystem != OperatingSystem)
            {
                dis += 1;
            }

            return(dis +
                   Math.Abs(Duration.TotalMinutes - s.Duration.TotalMinutes) +
                   Math.Abs(Requests.Count() - s.Requests.Count()) +
                   distanceTime(StartTime, s.StartTime) +
                   LevenshteinDistance.Compute(GetTransaction(), s.GetTransaction()) * SCALE);
            //similaritor.GetDissimilarity(GetTransaction(), s.GetTransaction()) * SCALE;
        }
Example #2
0
        public double Distance(IDistancable t)
        {
            User u = t as User;

            if (u == null)
            {
                return(-1);
            }

            double dis = Math.Abs(Sessions.Count() - u.Sessions.Count());

            foreach (var s in Sessions)
            {
                foreach (var ss in u.Sessions)
                {
                    dis += s.Distance(ss);
                }
            }

            return(dis);
        }
Example #3
0
 public DbscanPoint(IDistancable x)
 {
     ClusterPoint = x;
     IsVisited    = false;
     ClusterId    = UNCLASSIFIED;
 }
Example #4
0
 private IEnumerable <DbscanPoint> neighbor(IDistancable point)
 {
     return(_dataset.Where(x => point.Distance(x.ClusterPoint) <= Epsilon));
 }