-
Notifications
You must be signed in to change notification settings - Fork 7
Clust
Randall O'Reilly edited this page Sep 11, 2019
·
1 revision
The clust
package does standard agglomerative hierarchical clustering: https://en.wikipedia.org/wiki/Hierarchical_clustering
- Docs: clust
ix := etable.NewIdxView(table) // works on an index view so it can be filtered etc
nm, _ := ix.Table.MetaData["name"]
// first compute the distance matrix using whatever metric you want
smat := &simat.SimMat{}
smat.TableCol(ix, colNm, "TrialName", false, metric.Euclidean64)
// then do the clustering
cl := clust.Glom(smat, clust.MinDist) // can choose MaxDist or AvgDist or write your own
// then plot the results
pt := &etable.Table{}
clust.Plot(pt, cl, smat)
plt := &eplot.Plot2D{}
plt.InitName(plt, colNm)
plt.Params.Title = "Cluster Plot of: " + nm + " " + colNm
plt.Params.XAxisCol = "X"
plt.SetTable(pt)
// order of params: on, fixMin, min, fixMax, max
plt.SetColParams("X", false, true, 0, false, 0)
plt.SetColParams("Y", true, true, 0, false, 0)
plt.SetColParams("Label", true, false, 0, false, 0)