/// <summary> /// Create an optimizer which finds the curve that minimizes the number of clusters found using a ClusterCounter. /// </summary> /// <param name="outlierSize">OutlierSize to use with the ClusterCounter.</param> /// <param name="noiseSkipBy">NoiseSkipBy to use with the ClusterCounter.</param> /// <param name="reducedNoiseSkipBy">ReducedNoiseSkipBy to use with the ClusterCounter.</param> /// <param name="strategy">Strategy to employ that decides how many dimensions to scramble during each iteration.</param> public OptimalIndex(int outlierSize, int noiseSkipBy, int reducedNoiseSkipBy, Func <Permutation <uint>, int, int, Permutation <uint> > strategy) { var maxOutliers = outlierSize; var skip = noiseSkipBy; Metric = (HilbertIndex index) => { var counter = new ClusterCounter { OutlierSize = maxOutliers, NoiseSkipBy = skip, ReducedNoiseSkipBy = reducedNoiseSkipBy, LowestCountSeen = LowestCountSeen }; var counts = counter.Count(index.SortedPoints); return(new Tuple <int, long>(counts.CountExcludingOutliers, counts.MaximumSquareDistance)); }; PermutationStrategy = strategy; ShouldCompact = false; }
/// <summary> /// Create an optimizer which finds the curve that minimizes the number of clusters found using a ClusterCounter. /// </summary> /// <param name="outlierSize">OutlierSize to use with the ClusterCounter.</param> /// <param name="noiseSkipBy">NoiseSkipBy to use with the ClusterCounter.</param> /// <param name="reducedNoiseSkipBy">ReducedNoiseSkipBy to use with the ClusterCounter.</param> /// <param name="strategy">Strategy to employ that decides how many dimensions to scramble during each iteration.</param> /// <param name="bitsPerDimension">Bits per dimension which MUST BE STATED, not given as -1.</param> public OptimalPermutation(int outlierSize, int noiseSkipBy, int reducedNoiseSkipBy, Func <Permutation <uint>, int, int, Permutation <uint> > strategy, int bitsPerDimension) { var maxOutliers = outlierSize; var skip = noiseSkipBy; Metric = (IReadOnlyList <UnsignedPoint> sortedPoints) => { var counter = new ClusterCounter { OutlierSize = maxOutliers, NoiseSkipBy = skip, ReducedNoiseSkipBy = reducedNoiseSkipBy, LowestCountSeen = LowestCountSeen }; var counts = counter.Count(sortedPoints); return(new Tuple <int, long>(counts.CountExcludingOutliers, counts.MaximumSquareDistance)); }; PermutationStrategy = strategy; BitsPerDimension = bitsPerDimension; }