anchor.diff:      StyleParam.Colorscale.Electric //Custom [(0.0,"#3D9970");(1.0,"#001f3f")]
       
   let dataChart = 
  -    Chart.Heatmap(data,ColNames=colnames,RowNames=(lable |> Seq.mapi (fun i s -> sprintf "%s%i" s i )),Colorscale=colorscaleValue,Showscale=true)
  +    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
  -open FSharp.Stats.ML.Unsupervised.HierarchicalClustering
   
   
   // Kmeans clustering
  
positive.code: (**
  ##Hierarchical clustering
  
  
  
  *)
  
  //let htmp = HierarchicalClustering.generate' DistanceMetrics.euclidean Linker.wardLwLinker data
  // slower
  
  let htmp = 
      HierarchicalClustering.generate DistanceMetrics.euclidean Linker.wardLwLinker data
      |> HierarchicalClustering.flattenHClust
  
  let hlable =    
      htmp
      |> Seq.map (fun c -> lable.[HierarchicalClustering.getClusterId c])
  
  let hdata =    
      htmp
      |> Seq.choose (fun c -> HierarchicalClustering.tryGetLeafValue c)
  
  
  let hierClusteredData = 
      let labels = hlable |> Seq.mapi (fun i s -> sprintf "%s%i" s i)
      Chart.Heatmap(hdata,ColNames=colnames,RowNames=labels,Colorscale=colorscaleValue,Showscale=true)
      |> Chart.withMarginSize(Left=250.)
      |> Chart.withTitle "clustered iris data (hierarchical Clustering)"
  (*** include-value:hierClusteredData ***)
  
  
  
  (**
  
  
negative.code:                 yield words }
  
                  
  let lables,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
      |> fun x -> Array.init 3 (fun _ -> x) |> Array.concat
      |> Array.shuffleFisherYates
      |> Array.mapi (fun i (lable,data) -> sprintf "%s_%i" lable i, data)
      |> Array.unzip
     
  (*** hide ***)
  