anchor.diff:                  distortionMetric matrix (centroids, clustering) // out of those get whatever has smaller distortion
               )
   
  -    let orderByPopularity (k: int) (matrix: Vector[]) (results: (Vector[] * int[]) list) =
  -        // calculate popularity of each group among all results
  -        let nResults = results.Length
  -
  -        let allGroups = 
  -            results 
  -            |> List.mapi (fun i (centroids, clustering) -> 
  -                let groups = 
  -                    clustering
  -                    |> Seq.mapi (fun i ci -> ci, matrix.[i])
  -                    |> toMultiMap
  -                    |> Map.toList
  -                    |> List.map (fun (ci, group) -> group |> List.sort)
  -                i, groups
  -            )
  -            |> Map.ofList
  -
  -        let counters = 
  -            allGroups 
  -            |> Map.toSeq 
  -            |> Seq.collect (fun (i, groups) -> 
  -                groups
  -                |> List.map (fun g -> g, 1)
  -            )
  -            |> toMultiMap
  -            |> Map.toSeq
  -            |> Seq.map (fun (g, counters) -> g, List.sum counters)
  -            |> Map.ofSeq
  -
  -        results
  -        |> Seq.mapi(fun i (centroids, clustering) ->
  -            let groups = allGroups.[i]
  -            let total = 
  -                groups 
  -                |> List.map (fun g -> 
  -                    if g.Length <= k then counters.[g]
  -                    else 0
  -                )
  -                |> List.sum
  -            total, centroids, clustering
  -        )
  -        |> Seq.sortBy(fun (total, centroids, clustering) -> -total)
  -        |> Seq.map (fun (total, centroids, clustering) -> centroids, clustering)
  -
       member this.computeGroups (dataSet: 'a array) (nGroups: int) =
           let input = dataSet |> Array.map featureExtractor
           let matrix = if shouldNormalize then normalize input else input
  
positive.code:         if applyMetric then
              let nClusteringIterations = 200
  
              let results = [for i in 0..nClusteringIterations do yield matrix |> cluster 0 nGroups rng]
  
              let sortedResults = 
                  results 
                  |> orderByPopularity groupSize matrix
                  //|> List.sortBy (fun clustering -> clustering |> resultMetric groupSize matrix)                
                  |> Seq.take 10
                  |> List.ofSeq
  
              sortedResults 
              |> List.sortBy (fun clustering -> clustering |> resultMetric groupSize matrix)                
              |> Seq.head
              |> snd
  
                  (*
                  results
                  |> List.sortBy (fun clustering -> clustering |> resultMetric groupSize matrix)
                  |> Seq.take 20
  
              //|> Seq.head
              //|> snd
  
              sortedResults |> selectBestClustering groupSize matrix
              *)
          else
              snd (matrix |> cluster 0 nGroups rng)
  
  
negative.code: 
          iterate centroids [||]
  
      let distortionMetric (matrix: Vector[]) (centroids: Vector[], clustering: int[]) : float = 
          matrix
          |> Array.mapi (fun i row -> distance row centroids.[clustering.[i]])
          |> Array.sum
  
      let resultMetric (size: int) (matrix: Vector[]) (centroids: Vector[], clustering: int[]) =
              let groups = clustering |> Seq.groupBy id
              let nGroups = groups |> Seq.length
              let nOverbooked = groups |> Seq.filter (fun g -> snd g |> Seq.length > size) |> Seq.length
  