Program: 117186
Project: 117186
Buggy source:
/** 
 * <p> <pre> Usage: Predictor -d	data set path -m	model path [-r]	attribute file path [-p]	prediction path [-R]	residual path [-g]	task between classification (c) and regression (r) (default: r) [-P]	output probablity (default: false) </pre> </p>
 * @param args the command line arguments.
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
  Options opts=new Options();
  CmdLineParser parser=new CmdLineParser(Predictor.class,opts);
  Task task=null;
  try {
    parser.parse(args);
    task=Task.get(opts.task);
  }
 catch (  IllegalArgumentException e) {
    parser.printUsage();
    System.exit(1);
  }
  Instances instances=InstancesReader.read(opts.attPath,opts.dataPath);
  mltk.predictor.Predictor predictor=PredictorReader.read(opts.modelPath);
switch (task) {
case REGRESSION:
    Regressor regressor=(Regressor)predictor;
  double rmse=Evaluator.evalRMSE(regressor,instances);
System.out.println("String_Node_Str" + rmse);
if (opts.predictionPath != null) {
PrintWriter out=new PrintWriter(opts.predictionPath);
for (Instance instance : instances) {
  double pred=regressor.regress(instance);
  out.println(pred);
}
out.flush();
out.close();
}
if (opts.residualPath != null) {
PrintWriter out=new PrintWriter(opts.residualPath);
for (Instance instance : instances) {
double pred=regressor.regress(instance);
out.println(instance.getTarget() - pred);
}
out.flush();
out.close();
}
break;
case CLASSIFICATION:
Classifier classifier=(Classifier)predictor;
double error=Evaluator.evalError(classifier,instances);
System.out.println("String_Node_Str" + (error * 100) + "String_Node_Str");
if (opts.predictionPath != null) {
if (opts.prob) {
PrintWriter out=new PrintWriter(opts.predictionPath);
ProbabilisticClassifier probClassifier=(ProbabilisticClassifier)predictor;
for (Instance instance : instances) {
double[] pred=probClassifier.predictProbabilities(instance);
out.println(Arrays.toString(pred));
}
out.flush();
out.close();
}
 else {
PrintWriter out=new PrintWriter(opts.predictionPath);
for (Instance instance : instances) {
double pred=classifier.classify(instance);
out.println((int)pred);
}
out.flush();
out.close();
}
}
if (opts.residualPath != null) {
if (predictor instanceof Regressor) {
PrintWriter out=new PrintWriter(opts.residualPath);
Regressor regressingClassifier=(Regressor)predictor;
for (Instance instance : instances) {
double pred=regressingClassifier.regress(instance);
int cls=(int)instance.getTarget();
out.println(OptimUtils.getPseudoResidual(pred,cls));
}
out.flush();
out.close();
}
 else {
System.out.println("String_Node_Str");
}
}
break;
default :
break;
}
}

Fixed version (ground truth):
/** 
 * <p> <pre> Usage: mltk.predictor.evaluation.Predictor -d	data set path -m	model path [-r]	attribute file path [-p]	prediction path [-R]	residual path [-g]	task between classification (c) and regression (r) (default: r) [-P]	output probablity (default: false) </pre> </p>
 * @param args the command line arguments.
 * @throws Exception
 */
public static void main(String[] args) throws Exception {
  Options opts=new Options();
  CmdLineParser parser=new CmdLineParser(Predictor.class,opts);
  Task task=null;
  try {
    parser.parse(args);
    task=Task.get(opts.task);
  }
 catch (  IllegalArgumentException e) {
    parser.printUsage();
    System.exit(1);
  }
  Instances instances=InstancesReader.read(opts.attPath,opts.dataPath);
  mltk.predictor.Predictor predictor=PredictorReader.read(opts.modelPath);
switch (task) {
case REGRESSION:
    Regressor regressor=(Regressor)predictor;
  double rmse=Evaluator.evalRMSE(regressor,instances);
System.out.println("String_Node_Str" + rmse);
if (opts.predictionPath != null) {
PrintWriter out=new PrintWriter(opts.predictionPath);
for (Instance instance : instances) {
  double pred=regressor.regress(instance);
  out.println(pred);
}
out.flush();
out.close();
}
if (opts.residualPath != null) {
PrintWriter out=new PrintWriter(opts.residualPath);
for (Instance instance : instances) {
double pred=regressor.regress(instance);
out.println(instance.getTarget() - pred);
}
out.flush();
out.close();
}
break;
case CLASSIFICATION:
Classifier classifier=(Classifier)predictor;
double error=Evaluator.evalError(classifier,instances);
System.out.println("String_Node_Str" + (error * 100) + "String_Node_Str");
if (opts.predictionPath != null) {
if (opts.prob) {
PrintWriter out=new PrintWriter(opts.predictionPath);
ProbabilisticClassifier probClassifier=(ProbabilisticClassifier)predictor;
for (Instance instance : instances) {
double[] pred=probClassifier.predictProbabilities(instance);
out.println(Arrays.toString(pred));
}
out.flush();
out.close();
}
 else {
PrintWriter out=new PrintWriter(opts.predictionPath);
for (Instance instance : instances) {
double pred=classifier.classify(instance);
out.println((int)pred);
}
out.flush();
out.close();
}
}
if (opts.residualPath != null) {
if (predictor instanceof Regressor) {
PrintWriter out=new PrintWriter(opts.residualPath);
Regressor regressingClassifier=(Regressor)predictor;
for (Instance instance : instances) {
double pred=regressingClassifier.regress(instance);
int cls=(int)instance.getTarget();
out.println(OptimUtils.getPseudoResidual(pred,cls));
}
out.flush();
out.close();
}
 else {
System.out.println("String_Node_Str");
}
}
break;
default :
break;
}
}