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; }
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); }
public DbscanPoint(IDistancable x) { ClusterPoint = x; IsVisited = false; ClusterId = UNCLASSIFIED; }
private IEnumerable <DbscanPoint> neighbor(IDistancable point) { return(_dataset.Where(x => point.Distance(x.ClusterPoint) <= Epsilon)); }