add kmeans hadoop
This commit is contained in:
parent
dcb6e22a9e
commit
5fe3c58b4a
9
toolkit/kmeans_hadoop.sh
Executable file
9
toolkit/kmeans_hadoop.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ "$#" -lt 5 ];
|
||||||
|
then
|
||||||
|
echo "Usage: <nslaves> <input_data> <ncluster> <max_iteration> <output>"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
python ../rabit_hadoop.py -s $1 -i $2 -m kmeans --args "stdin "$3" "$4" stdout" -o $5
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +35,8 @@ if hadoop_streaming_jar != None:
|
|||||||
args.hadoop_streaming_jar = hadoop_streaming_jar
|
args.hadoop_streaming_jar = hadoop_streaming_jar
|
||||||
|
|
||||||
def hadoop_streaming(nslaves, slave_args):
|
def hadoop_streaming(nslaves, slave_args):
|
||||||
cmd = '%s jar %s -input %s -output %s -mapper \"%s stdin %d %d stdout %s\" -reducer \"/bin/cat\" -file %s -D mapred.map.tasks=%d' % (args.hadoop_binary, args.hadoop_streaming_jar, args.input, args.output, args.mapper, args.nclusters, args.iterations, ' '.join(slave_args), args.mapper, nslaves)
|
cmd = '%s jar %s -input %s -output %s -mapper \"%s %s %s\" -reducer \"/bin/cat\" -file %s -D mapred.map.tasks=%d'
|
||||||
|
% (args.hadoop_binary, args.hadoop_streaming_jar, args.input, args.output, args.mapper, args.args, ' '.join(slave_args), args.mapper, nslaves)
|
||||||
print cmd
|
print cmd
|
||||||
subprocess.check_call(cmd, shell = True)
|
subprocess.check_call(cmd, shell = True)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user