public IEnumerable <TPoint> MisplacedPoints(Classification <TPoint, TLabel> goldPartition) { var misplaced = new List <TPoint>(); foreach (var thisLabel in ClassLabels()) { var correspondingLabel = PointsInClass(thisLabel).Select(goldPartition.GetClassLabel) .GroupBy(goldLabel => goldLabel) .OrderByDescending(grp => grp.Count()) .Select(grp => grp.Key).First(); misplaced.AddRange(PointsInClass(thisLabel).Where(p => !goldPartition.GetClassLabel(p).Equals(correspondingLabel))); } return(misplaced); }
/// <summary> /// Since categories may have been merged since this was created, update Color1 and Color2 /// to reflect the current categorization of Point1 and Point2. /// </summary> /// <param name="clusters">Current clustering of points.</param> public ClosestPair Relabel(Classification <UnsignedPoint, TLabel> clusters) { Color1 = clusters.GetClassLabel(Point1); Color2 = clusters.GetClassLabel(Point2); return(this); }