blob: 3667e8cee5397ccb864eddbd8f80703323bfeedc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
KMeans Classifier Implementation
Examples:
Generate 1000 rows of test data, clustered around 3 points:
# generate test data
./gen-data.rb 1000 3 > example.dat
# classify data, plot results as png
./km-test kmeans example.dat example.png
Run all tests and save best clustering in current directory along with
PNGs of results:
for i in tests/*dat; do
# build paths
png_path=kmeans-$(basename ${i/dat/png})
dst_path=kmeans-$(basename $i)
# run test
echo $i
./km-test kmeans $i $png_path > $dst_path
done
|