int gramSize = 1;
if (cmdLine.hasOption(gramSizeOpt)) {
gramSize = Integer.parseInt((String) cmdLine.getValue(gramSizeOpt));
}
BayesParameters params = new BayesParameters(gramSize);
String modelBasePath = (String) cmdLine.getValue(pathOpt);
String classifierType = (String) cmdLine.getValue(typeOpt);
String 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 alpha_i = "1.0";
if (cmdLine.hasOption(alphaOpt)) {
alpha_i = (String) cmdLine.getValue(alphaOpt);
}
boolean verbose = cmdLine.hasOption(verboseOutputOpt);
String testDirPath = (String) cmdLine.getValue(dirOpt);
String classificationMethod = (String) cmdLine.getValue(methodOpt);
params.set("verbose", Boolean.toString(verbose));
params.set("basePath", modelBasePath);
params.set("classifierType", classifierType);
params.set("dataSource", dataSource);
params.set("defaultCat", defaultCat);
params.set("encoding", encoding);
params.set("alpha_i", alpha_i);
params.set("testDirPath", testDirPath);
if (classificationMethod.equalsIgnoreCase("sequential"))
classifySequential(params);
else if (classificationMethod.equalsIgnoreCase("mapreduce"))
classifyParallel(params);