if (cmdLine.hasOption(helpOpt)) {
CommandLineUtil.printHelp(group);
return;
}
BayesParameters params = new BayesParameters();
// Setting all default values
int gramSize = 1;
String modelBasePath = (String) cmdLine.getValue(pathOpt);
if (cmdLine.hasOption(gramSizeOpt)) {
gramSize = Integer.parseInt((String) cmdLine.getValue(gramSizeOpt));
}
String classifierType = "bayes";
if (cmdLine.hasOption(typeOpt)) {
classifierType = (String) cmdLine.getValue(typeOpt);
}
String dataSource = "hdfs";
if (cmdLine.hasOption(dataSourceOpt)) {
dataSource = (String) cmdLine.getValue(dataSourceOpt);
}
String defaultCat = "unknown";
if (cmdLine.hasOption(defaultCatOpt)) {
defaultCat = (String) cmdLine.getValue(defaultCatOpt);
}
String encoding = "UTF-8";
if (cmdLine.hasOption(encodingOpt)) {
encoding = (String) cmdLine.getValue(encodingOpt);
}
String alphaI = "1.0";
if (cmdLine.hasOption(alphaOpt)) {
alphaI = (String) cmdLine.getValue(alphaOpt);
}
boolean verbose = cmdLine.hasOption(verboseOutputOpt);
String testDirPath = (String) cmdLine.getValue(dirOpt);
String classificationMethod = "sequential";
if (cmdLine.hasOption(methodOpt)) {
classificationMethod = (String) cmdLine.getValue(methodOpt);
}
params.setGramSize(gramSize);
params.set("verbose", Boolean.toString(verbose));
params.setBasePath(modelBasePath);
params.set("classifierType", classifierType);
params.set("dataSource", dataSource);
params.set("defaultCat", defaultCat);
params.set("encoding", encoding);
params.set("alpha_i", alphaI);
params.set("testDirPath", testDirPath);
if ("sequential".equalsIgnoreCase(classificationMethod)) {
classifySequential(params);
} else if ("mapreduce".equalsIgnoreCase(classificationMethod)) {
classifyParallel(params);