-
Notifications
You must be signed in to change notification settings - Fork 4
/
RunKmeansLocal.sh
42 lines (29 loc) · 1014 Bytes
/
RunKmeansLocal.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
# assumes python and spark-submit are in your path
export ALPREFIX=$HOME/Documents/alchemist/bins # or whatever you used during install
export TMPDIR=/tmp # avoid a Mac specific issue with tmpdir length
sbt -batch assembly
# user specified
PROJ_HOME="$HOME/Documents/alchemist"
MASTER="local[3]"
CLUSTER_NUM="10"
MAX_ITERS="100"
# the rest does not need change
# data
export DATA_FILE="$PROJ_HOME/data/mnist.t"
# save clustering results
OUTPUT_DIR="$PROJ_HOME/tmp"
mkdir $OUTPUT_DIR
export OUTPUT_FILE="$OUTPUT_DIR/kmeans_result"
# .jar file
JAR_FILE="$PROJ_HOME/test/target/scala-2.11/test-kmeans-assembly-0.0.2.jar"
spark-submit \
--master $MASTER \
$JAR_FILE $CLUSTER_NUM $MAX_ITERS \
> ResultTestKmeans.out
# Compute NMI using a Python script
MNI_PY="$PROJ_HOME/test/src/main/scala/amplab/alchemist/nmi.py"
python $MNI_PY -f $OUTPUT_FILE"_spark.txt" \
>> ResultTestKmeans.out
python $MNI_PY -f $OUTPUT_FILE"_alchemist.txt" \
>> ResultTestKmeans.out