Skip to content

Commit 0ae6140

Browse files
committed
cleanup code and comments
- add comment for .ml.ismin - replace .ml.f2nd with f2nd within .ml.lloyds - fix spelling of lloyd
1 parent c3fbd8c commit 0ae6140

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ml.q

+6-5
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ zscore:fxx zscoref:{daxf[%;nsdev;x] demeanf[x]::}
131131
minmax:fxx minmaxf:{daxf[%;{max[x]-min x};x] daxf[-;min;x]::}
132132
/ convert densities into probabilities
133133
prb:dax[%;sum]
134+
/ identify the minimum values with 1b
134135
ismin:dax[=;min]
135136

136137
/ given (g)rouped dictionary, compute the odds
@@ -299,17 +300,17 @@ cgroup:{[df;X;C]value group imin f2nd[df X] C}
299300
/ to update the centroid location.
300301
lloyd:{[df;cf;X;C]cf X@\: cgroup[df;X;C]}
301302
/ use (r)esponsibility (f)unction David Mackay's Information Theory..(pg289)
302-
lloyds:{[df;cf;rf;X;C] cf[rf .ml.f2nd[df X] C;X]} /soft assignment
303+
lloyds:{[df;cf;rf;X;C] cf[rf f2nd[df X] C;X]} / soft assignment
303304

304305
kmeans:lloyd[edist2;avg''] / k-means
305306
kmedians:lloyd[mdist;med''] / k-medians
306307
khmeans:lloyd[edist2;hmean''] / k harmonic means
307308
skmeans:lloyd[cosdist;normalize (avg'')::] / spherical k-means
308309

309-
kmeanss:lloyds[edist2;wavg\:/:;ismin] /k-means using loyd with rf
310-
/ kmeansoft v1 David Mackay (b)eta stiffness param
311-
/ sigma or radius of cluster is 1%sqrt b
312-
kmeanssmax:{[b;X] lloyds[edist2;wavg\:/:;softmax neg[b]*;X]}
310+
kmeanss:lloyds[edist2;wavg\:/:;ismin] / k-means using Lloyd with rf
311+
/ v1 David Mackay using stiffness parameter (b)eta. 1%sqrt b represents the
312+
/ sigma (or radius) of the cluster
313+
kmeanssmax:{[b;X]lloyds[edist2;wavg\:/:;softmax neg[b]*;X]}
313314

314315
/ using (d)istance (f)unction, find the medoid in matri(X)
315316
medoid:{[df;X]X@\:imin f2nd[sum df[X]::] X}

0 commit comments

Comments
 (0)