anchor.diff:  (**
   #Clustering
   
  -##Iterative Clustering
  -
  -###k-means clustering
  +
  +For demonstration of several clustering methods, the classic iris data set is used, which consists of 150 records, each of which contains four measurements and a species identifier.
  +Since the species identifier occur several times (_Iris-irginica_, _Iris-versicolor_, and _Iris-setosa_), the first step is to generate unique labels:
  +
  +  - The data is shuffled and an index is appended to the data label, such that each label is unique.
   *)
   
   open FSharp.Stats
  
positive.code:                 yield words }
  
                  
  let lable,data =
      fromFileWithSep ',' (__SOURCE_DIRECTORY__ + "/data/irisData.csv")
      |> Seq.skip 1
      |> Seq.map (fun arr -> arr.[4], [| float arr.[0]; float arr.[1]; float arr.[2]; float arr.[3]; |])
      |> Seq.toArray
      |> Array.shuffleFisherYates
      |> Array.unzip
     
  (*** hide ***)
  
negative.code:     StyleParam.Colorscale.Electric //Custom [(0.0,"#3D9970");(1.0,"#001f3f")]
      
  let dataChart = 
      Chart.Heatmap(data,ColNames=colnames,RowNames=lables,Colorscale=colorscaleValue,Showscale=true)
      |> Chart.withMarginSize(Left=250.)
      |> Chart.withTitle "raw iris data"
  (*** include-value:dataChart ***)
  
  
  (**
  ##Iterative Clustering
  
  ###k-means clustering
  
  In k-means clustering a cluster number has to be specified prior to clustering the data. K centroids are randomly chosen.
  After all data points are assigned to their nearest centroid, the algorithm iteratively approaches a centroid position configuration,
  that minimizes the dispersion of every of the k clusters.
  For cluster number determination see below (Determining the optimal number of clusters).
  *)
  
  open FSharp.Stats.ML
  open FSharp.Stats.ML.Unsupervised
  
  
  // Kmeans clustering
  