nus-yam/ex-repair huggingface dataset:
Program: 92550
Project: 92550
Buggy source:
/** 
 * Returns a new dataset without given columns. 
 */
public AttributeDataset remove(String... cols){
  Attribute[] attrs=new Attribute[cols.length];
  int[] index=new int[cols.length];
  for (int j=0, i=0; j < attributes.length; j++) {
    boolean hit=false;
    for (int k=0; k < cols.length; k++) {
      if (attributes[j].getName().equals(cols[k])) {
        hit=true;
        break;
      }
    }
    if (!hit) {
      index[i]=j;
      attrs[i]=attributes[j];
      i++;
    }
  }
  AttributeDataset sub=new AttributeDataset(name,attrs,response);
  for (  Datum<double[]> datum : data) {
    double[] x=new double[index.length];
    for (int i=0; i < x.length; i++) {
      x[i]=datum.x[index[i]];
    }
    Row row=response == null ? sub.add(x) : sub.add(x,datum.y);
    row.name=datum.name;
    row.weight=datum.weight;
    row.description=datum.description;
    row.timestamp=datum.timestamp;
  }
  return sub;
}

Fixed version (ground truth):
/** 
 * Returns a new dataset without given columns. 
 */
public AttributeDataset remove(String... cols){
  HashSet<String> remains=new HashSet<>();
  for (  Attribute attr : attributes) {
    remains.add(attr.getName());
  }
  for (  String col : cols) {
    remains.remove(col);
  }
  Attribute[] attrs=new Attribute[remains.size()];
  int[] index=new int[remains.size()];
  for (int j=0, i=0; j < attributes.length; j++) {
    if (remains.contains(attributes[j].getName())) {
      index[i]=j;
      attrs[i]=attributes[j];
      i++;
    }
  }
  AttributeDataset sub=new AttributeDataset(name,attrs,response);
  for (  Datum<double[]> datum : data) {
    double[] x=new double[index.length];
    for (int i=0; i < x.length; i++) {
      x[i]=datum.x[index[i]];
    }
    Row row=response == null ? sub.add(x) : sub.add(x,datum.y);
    row.name=datum.name;
    row.weight=datum.weight;
    row.description=datum.description;
    row.timestamp=datum.timestamp;
  }
  return sub;
}
Program: 92551
Project: 92551
Buggy source:
/** 
 * Algorithm from Alan Genz (1992) Numerical Computation of  Multivariate Normal Probabilities, Journal of Computational and  Graphical Statistics, pp. 141-149. The difference between returned value and the true value of the CDF is less than 0.001 in 99.9% time. The maximum number of iterations is set to 10000.
 */
@Override public double cdf(double[] x){
  if (x.length != dim) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int Nmax=10000;
  double alph=GaussianDistribution.getInstance().quantile(0.999);
  double errMax=0.001;
  double[] v=x.clone();
  Math.minus(v,mu);
  double p=0.0;
  double varSum=0.0;
  double[] f=new double[dim];
  f[0]=GaussianDistribution.getInstance().cdf(v[0] / sigmaL.get(0,0));
  double[] y=new double[dim];
  double err=2 * errMax;
  int N;
  for (N=1; err > errMax && N <= Nmax; N++) {
    double[] w=Math.random(dim - 1);
    for (int i=1; i < dim; i++) {
      y[i - 1]=GaussianDistribution.getInstance().quantile(w[i - 1] * f[i - 1]);
      double q=0.0;
      for (int j=0; j < i; j++) {
        q+=sigmaL.get(i,j) * y[j];
      }
      f[i]=GaussianDistribution.getInstance().cdf((v[i] - q) / sigmaL.get(i,i)) * f[i - 1];
    }
    double del=(f[dim - 1] - p) / N;
    p+=del;
    varSum=(N - 2) * varSum / N + del * del;
    err=alph * Math.sqrt(varSum);
  }
  return p;
}

Fixed version (ground truth):
/** 
 * Algorithm from Alan Genz (1992) Numerical Computation of  Multivariate Normal Probabilities, Journal of Computational and  Graphical Statistics, pp. 141-149. The difference between returned value and the true value of the CDF is less than 0.001 in 99.9% time. The maximum number of iterations is set to 10000.
 */
@Override public double cdf(double[] x){
  if (x.length != dim) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int Nmax=10000;
  double alph=GaussianDistribution.getInstance().quantile(0.999);
  double errMax=0.001;
  double[] v=x.clone();
  Math.minus(v,mu);
  double p=0.0;
  double varSum=0.0;
  double[] e=new double[dim];
  double[] f=new double[dim];
  e[0]=GaussianDistribution.getInstance().cdf(v[0] / sigmaL.get(0,0));
  f[0]=e[0];
  double[] y=new double[dim];
  double err=2 * errMax;
  int N;
  for (N=1; err > errMax && N <= Nmax; N++) {
    double[] w=Math.random(dim - 1);
    for (int i=1; i < dim; i++) {
      y[i - 1]=GaussianDistribution.getInstance().quantile(w[i - 1] * e[i - 1]);
      double q=0.0;
      for (int j=0; j < i; j++) {
        q+=sigmaL.get(i,j) * y[j];
      }
      e[i]=GaussianDistribution.getInstance().cdf((v[i] - q) / sigmaL.get(i,i));
      f[i]=e[i] * f[i - 1];
    }
    double del=(f[dim - 1] - p) / N;
    p+=del;
    varSum=(N - 2) * varSum / N + del * del;
    err=alph * Math.sqrt(varSum);
  }
  return p;
}
Program: 92552
Project: 92552
Buggy source:
/** 
 * Test of cdf method, of class MultivariateGaussian.
 */
@Test public void testCdf(){
  System.out.println("String_Node_Str");
  MultivariateGaussianDistribution instance=new MultivariateGaussianDistribution(mu,sigma);
  for (int i=0; i < x.length; i++) {
    assertEquals(cdf[i],instance.cdf(x[i]),1E-2);
  }
}

Fixed version (ground truth):
/** 
 * Test of cdf method, of class MultivariateGaussian.
 */
@Test public void testCdf(){
  System.out.println("String_Node_Str");
  MultivariateGaussianDistribution instance=new MultivariateGaussianDistribution(mu,sigma);
  for (int i=0; i < x.length; i++) {
    assertEquals(cdf[i],instance.cdf(x[i]),5E-3);
  }
}
Program: 92554
Project: 92554
Buggy source:
@Override public double[][] learn(double[] x,double[] y){
  try {
    k=Integer.parseInt(kField.getText().trim());
    if (k < 1) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + k,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + kField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  KNN<double[]> knn=KNN.learn(data,label,k);
  for (int i=0; i < label.length; i++) {
    label[i]=knn.predict(data[i]);
  }
  double trainError=error(label,label);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=knn.predict(p);
    }
  }
  return z;
}

Fixed version (ground truth):
@Override public double[][] learn(double[] x,double[] y){
  try {
    k=Integer.parseInt(kField.getText().trim());
    if (k < 1) {
      JOptionPane.showMessageDialog(this,"String_Node_Str" + k,"String_Node_Str",JOptionPane.ERROR_MESSAGE);
      return null;
    }
  }
 catch (  Exception ex) {
    JOptionPane.showMessageDialog(this,"String_Node_Str" + kField.getText(),"String_Node_Str",JOptionPane.ERROR_MESSAGE);
    return null;
  }
  double[][] data=dataset[datasetIndex].toArray(new double[dataset[datasetIndex].size()][]);
  int[] label=dataset[datasetIndex].toArray(new int[dataset[datasetIndex].size()]);
  KNN<double[]> knn=KNN.learn(data,label,k);
  int[] pred=new int[label.length];
  for (int i=0; i < label.length; i++) {
    pred[i]=knn.predict(data[i]);
  }
  double trainError=error(pred,label);
  System.out.format("String_Node_Str",100 * trainError);
  double[][] z=new double[y.length][x.length];
  for (int i=0; i < y.length; i++) {
    for (int j=0; j < x.length; j++) {
      double[] p={x[j],y[i]};
      z[i][j]=knn.predict(p);
    }
  }
  return z;
}
Program: 92555
Project: 92555
Buggy source:
/** 
 * Reads a sparse instance using the tokenizer.
 * @throws ParseException if the information is not read successfully
 */
private void readSparseInstance(StreamTokenizer tokenizer,AttributeDataset data,Attribute[] attributes) throws IOException, ParseException {
  double[] x=responseIndex >= 0 ? new double[attributes.length - 1] : new double[attributes.length];
  double y=Double.NaN;
  int index=-1;
  do {
    getNextToken(tokenizer);
    if (tokenizer.ttype == '}') {
      break;
    }
    String s=tokenizer.sval.trim();
    if (index < 0) {
      index=Integer.parseInt(s);
      if (index < 0 || index >= attributes.length) {
        throw new ParseException("String_Node_Str" + index,tokenizer.lineno());
      }
    }
 else {
      String val=s;
      if (index != responseIndex) {
        if (val.equals("String_Node_Str")) {
          x[index]=Double.NaN;
        }
 else {
          x[index]=attributes[index].valueOf(val);
        }
      }
 else {
        if (val.equals("String_Node_Str")) {
          y=Double.NaN;
        }
 else {
          y=attributes[index].valueOf(val);
        }
      }
      index=-1;
    }
  }
 while (tokenizer.ttype == StreamTokenizer.TT_WORD);
  data.add(x,y);
}

Fixed version (ground truth):
/** 
 * Reads a sparse instance using the tokenizer.
 * @throws ParseException if the information is not read successfully
 */
private void readSparseInstance(StreamTokenizer tokenizer,AttributeDataset data,Attribute[] attributes) throws IOException, ParseException {
  double[] x=responseIndex >= 0 ? new double[attributes.length - 1] : new double[attributes.length];
  double y=Double.NaN;
  int index=-1;
  do {
    getNextToken(tokenizer);
    if (tokenizer.ttype == '}') {
      break;
    }
    String s=tokenizer.sval.trim();
    if (index < 0) {
      index=Integer.parseInt(s);
      if (index < 0 || index >= attributes.length) {
        throw new ParseException("String_Node_Str" + index,tokenizer.lineno());
      }
    }
 else {
      String val=s;
      if (index != responseIndex) {
        if (val.equals("String_Node_Str")) {
          x[index]=Double.NaN;
        }
 else {
          x[index]=attributes[index].valueOf(val);
        }
      }
 else {
        if (val.equals("String_Node_Str")) {
          y=Double.NaN;
        }
 else {
          y=attributes[index].valueOf(val);
        }
      }
      index=-1;
    }
  }
 while (tokenizer.ttype == StreamTokenizer.TT_WORD);
  if (Double.isNaN(y))   data.add(x);
 else   data.add(x,y);
}
Program: 92556
Project: 92556
Buggy source:
/** 
 * Reads a single instance.
 * @throws ParseException if the information is not read successfully
 */
private void readInstance(StreamTokenizer tokenizer,AttributeDataset data,Attribute[] attributes) throws IOException, ParseException {
  double[] x=responseIndex >= 0 ? new double[attributes.length - 1] : new double[attributes.length];
  double y=Double.NaN;
  for (int i=0, k=0; i < attributes.length; i++) {
    if (i > 0) {
      getNextToken(tokenizer);
    }
    if (i == responseIndex) {
      if (tokenizer.ttype == '?') {
        y=Double.NaN;
      }
 else {
        y=attributes[i].valueOf(tokenizer.sval);
      }
    }
 else {
      if (tokenizer.ttype == '?') {
        x[k++]=Double.NaN;
      }
 else {
        x[k++]=attributes[i].valueOf(tokenizer.sval);
      }
    }
  }
  data.add(x,y);
}

Fixed version (ground truth):
/** 
 * Reads a single instance.
 * @throws ParseException if the information is not read successfully
 */
private void readInstance(StreamTokenizer tokenizer,AttributeDataset data,Attribute[] attributes) throws IOException, ParseException {
  double[] x=responseIndex >= 0 ? new double[attributes.length - 1] : new double[attributes.length];
  double y=Double.NaN;
  for (int i=0, k=0; i < attributes.length; i++) {
    if (i > 0) {
      getNextToken(tokenizer);
    }
    if (i == responseIndex) {
      if (tokenizer.ttype == '?') {
        y=Double.NaN;
      }
 else {
        y=attributes[i].valueOf(tokenizer.sval);
      }
    }
 else {
      if (tokenizer.ttype == '?') {
        x[k++]=Double.NaN;
      }
 else {
        x[k++]=attributes[i].valueOf(tokenizer.sval);
      }
    }
  }
  if (Double.isNaN(y))   data.add(x);
 else   data.add(x,y);
}
Program: 92560
Project: 92560
Buggy source:
/** 
 * Returns the row means for a matrix.
 */
public default double[] rowMeans(){
  int m=nrows();
  int n=ncols();
  double[] x=new double[m];
  for (int j=0; j < n; j++) {
    for (int i=1; i < m; i++) {
      x[i]+=get(i,j);
    }
  }
  for (int i=1; i < m; i++) {
    x[i]/=n;
  }
  return x;
}

Fixed version (ground truth):
/** 
 * Returns the row means for a matrix.
 */
public default double[] rowMeans(){
  int m=nrows();
  int n=ncols();
  double[] x=new double[m];
  for (int j=0; j < n; j++) {
    for (int i=0; i < m; i++) {
      x[i]+=get(i,j);
    }
  }
  for (int i=0; i < m; i++) {
    x[i]/=n;
  }
  return x;
}
Program: 92561
Project: 92561
Buggy source:
/** 
 * Returns the column means for a matrix.
 */
public default double[] colMeans(){
  int m=nrows();
  int n=ncols();
  double[] x=new double[n];
  ;
  for (int j=0; j < n; j++) {
    for (int i=1; i < m; i++) {
      x[j]+=get(i,j);
    }
    x[j]/=m;
  }
  return x;
}

Fixed version (ground truth):
/** 
 * Returns the column means for a matrix.
 */
public default double[] colMeans(){
  int m=nrows();
  int n=ncols();
  double[] x=new double[n];
  for (int j=0; j < n; j++) {
    for (int i=0; i < m; i++) {
      x[j]+=get(i,j);
    }
    x[j]/=m;
  }
  return x;
}
Program: 92563
Project: 92563
Buggy source:
/** 
 * Caulculate AUC for binary classifier.
 * @param truth The sample labels
 * @param probability The posterior probability of positive class.
 * @return AUC
 */
public static double measure(int[] truth,double[] probability){
  if (truth.length != probability.length) {
    throw new IllegalArgumentException(String.format("String_Node_Str",truth.length,probability.length));
  }
  int pos=0;
  int neg=0;
  for (int i=0; i < truth.length; i++) {
    if (truth[i] == 0) {
      neg++;
    }
 else     if (truth[i] == 1) {
      pos++;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + truth[i]);
    }
  }
  int[] label=truth.clone();
  double[] prediction=probability.clone();
  QuickSort.sort(prediction,label);
  double[] rank=new double[label.length];
  for (int i=0; i < prediction.length; i++) {
    if (i == prediction.length - 1 || prediction[i] != prediction[i + 1]) {
      rank[i]=i + 1;
    }
 else {
      int j=i + 1;
      for (; j < prediction.length && prediction[j] == prediction[i]; j++)       ;
      double r=(i + 1 + j) / 2.0;
      for (int k=i; k < j; k++)       rank[k]=r;
      i=j - 1;
    }
  }
  double auc=0.0;
  for (int i=0; i < label.length; i++) {
    if (label[i] == 1)     auc+=rank[i];
  }
  auc=(auc - (pos * (pos + 1) / 2.0)) / (pos * neg);
  return auc;
}

Fixed version (ground truth):
/** 
 * Caulculate AUC for binary classifier.
 * @param truth The sample labels
 * @param probability The posterior probability of positive class.
 * @return AUC
 */
public static double measure(int[] truth,double[] probability){
  if (truth.length != probability.length) {
    throw new IllegalArgumentException(String.format("String_Node_Str",truth.length,probability.length));
  }
  double pos=0;
  double neg=0;
  for (int i=0; i < truth.length; i++) {
    if (truth[i] == 0) {
      neg++;
    }
 else     if (truth[i] == 1) {
      pos++;
    }
 else {
      throw new IllegalArgumentException("String_Node_Str" + truth[i]);
    }
  }
  int[] label=truth.clone();
  double[] prediction=probability.clone();
  QuickSort.sort(prediction,label);
  double[] rank=new double[label.length];
  for (int i=0; i < prediction.length; i++) {
    if (i == prediction.length - 1 || prediction[i] != prediction[i + 1]) {
      rank[i]=i + 1;
    }
 else {
      int j=i + 1;
      for (; j < prediction.length && prediction[j] == prediction[i]; j++)       ;
      double r=(i + 1 + j) / 2.0;
      for (int k=i; k < j; k++)       rank[k]=r;
      i=j - 1;
    }
  }
  double auc=0.0;
  for (int i=0; i < label.length; i++) {
    if (label[i] == 1)     auc+=rank[i];
  }
  auc=(auc - (pos * (pos + 1) / 2.0)) / (pos * neg);
  return auc;
}
Program: 92564
Project: 92564
Buggy source:
/** 
 * Returns the singular value decomposition.
 */
public SingularValueDecomposition svd(){
  if (svd != null) {
    svd=new SingularValueDecomposition(this);
    rank=svd.rank();
  }
  return svd;
}

Fixed version (ground truth):
/** 
 * Returns the singular value decomposition.
 */
public SingularValueDecomposition svd(){
  if (svd == null) {
    svd=new SingularValueDecomposition(this);
    rank=svd.rank();
  }
  return svd;
}
Program: 92565
Project: 92565
Buggy source:
@Override public String toString(){
  StringBuilder sb=new StringBuilder();
  int m=Math.min(10,nrows());
  int n=Math.min(10,ncols());
  String newline=n < ncols() ? "String_Node_Str" : "String_Node_Str";
  for (int i=0; i < m; i++) {
    for (int j=0; j < n; j++) {
      sb.append(String.format("String_Node_Str",get(i,j)));
    }
    sb.append(newline);
  }
  if (m < nrows()) {
    sb.append("String_Node_Str");
  }
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuilder sb=new StringBuilder();
  final int fields=7;
  int m=Math.min(fields,nrows());
  int n=Math.min(fields,ncols());
  String newline=n < ncols() ? "String_Node_Str" : "String_Node_Str";
  for (int i=0; i < m; i++) {
    for (int j=0; j < n; j++) {
      sb.append(String.format("String_Node_Str",get(i,j)));
    }
    sb.append(newline);
  }
  if (m < nrows()) {
    sb.append("String_Node_Str");
  }
  return sb.toString();
}
Program: 92566
Project: 92566
Buggy source:
@Override void forward(double[] a,int n){
  if (n < 4) {
    return;
  }
  if (n > workspace.length) {
    workspace=new double[n];
  }
  int i, j;
  int n1=n - 1;
  int nh=n >> 1;
  for (i=0, j=1; j < n1; j+=2, i++) {
    workspace[i]=C * (a[j] + a[j + 1]);
    workspace[i + nh]=C * (a[j] - a[j + 1]);
  }
  workspace[i]=C * (a[n - 1] + a[0]);
  workspace[i + nh]=C * (a[n - 1] - a[0]);
  System.arraycopy(workspace,0,a,0,n);
}

Fixed version (ground truth):
@Override void forward(double[] a,int n){
  if (n < 2) {
    return;
  }
  if (n > workspace.length) {
    workspace=new double[n];
  }
  int n1=n - 1;
  int nh=n >> 1;
  for (int i=0, j=0; j < n1; j+=2, i++) {
    workspace[i]=C * (a[j] + a[j + 1]);
    workspace[i + nh]=C * (a[j] - a[j + 1]);
  }
  System.arraycopy(workspace,0,a,0,n);
}
Program: 92567
Project: 92567
Buggy source:
@Override void backward(double[] a,int n){
  if (n < 4) {
    return;
  }
  if (n > workspace.length) {
    workspace=new double[n];
  }
  int nh=n >> 1;
  int nh1=nh - 1;
  workspace[0]=C * (a[nh1] - a[n - 1]);
  workspace[n - 1]=C * (a[nh1] + a[n - 1]);
  for (int i=0, j=1; i < nh1; i++) {
    workspace[j++]=C * (a[i] + a[i + nh]);
    workspace[j++]=C * (a[i] - a[i + nh]);
  }
  System.arraycopy(workspace,0,a,0,n);
}

Fixed version (ground truth):
@Override void backward(double[] a,int n){
  if (n < 2) {
    return;
  }
  if (n > workspace.length) {
    workspace=new double[n];
  }
  int n1=n - 1;
  int nh=n >> 1;
  for (int i=0, j=0; j < n1; j+=2, i++) {
    workspace[j]=C * (a[i] + a[i + nh]);
    workspace[j + 1]=C * (a[i] - a[i + nh]);
  }
  System.arraycopy(workspace,0,a,0,n);
}
Program: 92568
Project: 92568
Buggy source:
/** 
 * Compute the network output error.
 * @param output the desired output.
 * @param gradient the array to store gradient on output.
 * @return the error defined by loss function.
 */
private double computeOutputError(double[] output,double[] gradient){
  if (output.length != outputLayer.units) {
    throw new IllegalArgumentException(String.format("String_Node_Str",output.length,outputLayer.units));
  }
  double error=0.0;
  for (int i=0; i < outputLayer.units; i++) {
    double out=outputLayer.output[i];
    double g=output[i] - out;
    if (errorFunction == ErrorFunction.LEAST_MEAN_SQUARES && activationFunction == ActivationFunction.LOGISTIC_SIGMOID) {
      g*=out * (1.0 - out);
    }
    if (errorFunction == ErrorFunction.LEAST_MEAN_SQUARES) {
      error+=0.5 * g * g;
    }
 else     if (errorFunction == ErrorFunction.CROSS_ENTROPY) {
      if (activationFunction == ActivationFunction.SOFTMAX) {
        error-=output[i] * log(out);
      }
 else       if (activationFunction == ActivationFunction.LOGISTIC_SIGMOID) {
        error=-output[i] * log(out) - (1.0 - output[i]) * log(1.0 - out);
      }
    }
    gradient[i]=g;
  }
  return error;
}

Fixed version (ground truth):
/** 
 * Compute the network output error.
 * @param output the desired output.
 * @param gradient the array to store gradient on output.
 * @return the error defined by loss function.
 */
private double computeOutputError(double[] output,double[] gradient){
  if (output.length != outputLayer.units) {
    throw new IllegalArgumentException(String.format("String_Node_Str",output.length,outputLayer.units));
  }
  double error=0.0;
  for (int i=0; i < outputLayer.units; i++) {
    double out=outputLayer.output[i];
    double g=output[i] - out;
    if (errorFunction == ErrorFunction.LEAST_MEAN_SQUARES) {
      error+=0.5 * g * g;
    }
 else     if (errorFunction == ErrorFunction.CROSS_ENTROPY) {
      if (activationFunction == ActivationFunction.SOFTMAX) {
        error-=output[i] * log(out);
      }
 else       if (activationFunction == ActivationFunction.LOGISTIC_SIGMOID) {
        error=-output[i] * log(out) - (1.0 - output[i]) * log(1.0 - out);
      }
    }
    if (errorFunction == ErrorFunction.LEAST_MEAN_SQUARES && activationFunction == ActivationFunction.LOGISTIC_SIGMOID) {
      g*=out * (1.0 - out);
    }
    gradient[i]=g;
  }
  return error;
}
Program: 92569
Project: 92569
Buggy source:
@Override public int predict(int[] x,double[] posteriori){
  if (posteriori != null && posteriori.length != k) {
    throw new IllegalArgumentException(String.format("String_Node_Str",posteriori.length,k));
  }
  if (w != null) {
    double f=1.0 / (1.0 + Math.exp(-dot(x,w)));
    if (posteriori != null) {
      posteriori[0]=f;
      posteriori[1]=1.0 - f;
    }
    if (f < 0.5) {
      return 0;
    }
 else {
      return 1;
    }
  }
 else {
    int label=-1;
    double max=Double.NEGATIVE_INFINITY;
    for (int i=0; i < k; i++) {
      double prob=dot(x,W[i]);
      if (prob > max) {
        max=prob;
        label=i;
      }
      if (posteriori != null) {
        posteriori[i]=prob;
      }
    }
    if (posteriori != null) {
      double Z=0.0;
      for (int i=0; i < k; i++) {
        posteriori[i]=Math.exp(posteriori[i] - max);
        Z+=posteriori[i];
      }
      for (int i=0; i < k; i++) {
        posteriori[i]/=Z;
      }
    }
    return label;
  }
}

Fixed version (ground truth):
@Override public int predict(int[] x,double[] posteriori){
  if (posteriori != null && posteriori.length != k) {
    throw new IllegalArgumentException(String.format("String_Node_Str",posteriori.length,k));
  }
  if (w != null) {
    double f=1.0 / (1.0 + Math.exp(-dot(x,w)));
    if (posteriori != null) {
      posteriori[0]=1.0 - f;
      posteriori[1]=f;
    }
    if (f < 0.5) {
      return 0;
    }
 else {
      return 1;
    }
  }
 else {
    int label=-1;
    double max=Double.NEGATIVE_INFINITY;
    for (int i=0; i < k; i++) {
      double prob=dot(x,W[i]);
      if (prob > max) {
        max=prob;
        label=i;
      }
      if (posteriori != null) {
        posteriori[i]=prob;
      }
    }
    if (posteriori != null) {
      double Z=0.0;
      for (int i=0; i < k; i++) {
        posteriori[i]=Math.exp(posteriori[i] - max);
        Z+=posteriori[i];
      }
      for (int i=0; i < k; i++) {
        posteriori[i]/=Z;
      }
    }
    return label;
  }
}
Program: 92570
Project: 92570
Buggy source:
@Override public int predict(double[] x,double[] posteriori){
  if (x.length != p) {
    throw new IllegalArgumentException(String.format("String_Node_Str",x.length,p));
  }
  if (posteriori != null && posteriori.length != k) {
    throw new IllegalArgumentException(String.format("String_Node_Str",posteriori.length,k));
  }
  if (k == 2) {
    double f=1.0 / (1.0 + Math.exp(-dot(x,w)));
    if (posteriori != null) {
      posteriori[0]=f;
      posteriori[1]=1.0 - f;
    }
    if (f < 0.5) {
      return 0;
    }
 else {
      return 1;
    }
  }
 else {
    int label=-1;
    double max=Double.NEGATIVE_INFINITY;
    for (int i=0; i < k; i++) {
      double prob=dot(x,W[i]);
      if (prob > max) {
        max=prob;
        label=i;
      }
      if (posteriori != null) {
        posteriori[i]=prob;
      }
    }
    if (posteriori != null) {
      double Z=0.0;
      for (int i=0; i < k; i++) {
        posteriori[i]=Math.exp(posteriori[i] - max);
        Z+=posteriori[i];
      }
      for (int i=0; i < k; i++) {
        posteriori[i]/=Z;
      }
    }
    return label;
  }
}

Fixed version (ground truth):
@Override public int predict(double[] x,double[] posteriori){
  if (x.length != p) {
    throw new IllegalArgumentException(String.format("String_Node_Str",x.length,p));
  }
  if (posteriori != null && posteriori.length != k) {
    throw new IllegalArgumentException(String.format("String_Node_Str",posteriori.length,k));
  }
  if (k == 2) {
    double f=1.0 / (1.0 + Math.exp(-dot(x,w)));
    if (posteriori != null) {
      posteriori[0]=1.0 - f;
      posteriori[1]=f;
    }
    if (f < 0.5) {
      return 0;
    }
 else {
      return 1;
    }
  }
 else {
    int label=-1;
    double max=Double.NEGATIVE_INFINITY;
    for (int i=0; i < k; i++) {
      double prob=dot(x,W[i]);
      if (prob > max) {
        max=prob;
        label=i;
      }
      if (posteriori != null) {
        posteriori[i]=prob;
      }
    }
    if (posteriori != null) {
      double Z=0.0;
      for (int i=0; i < k; i++) {
        posteriori[i]=Math.exp(posteriori[i] - max);
        Z+=posteriori[i];
      }
      for (int i=0; i < k; i++) {
        posteriori[i]/=Z;
      }
    }
    return label;
  }
}
Program: 92571
Project: 92571
Buggy source:
/** 
 * Assimilate a new value from the stream.
 */
public void add(double datum){
  sorted=false;
  if (n < k) {
    heap[n++]=datum;
    if (n == k) {
      heapify(heap);
    }
  }
 else {
    n++;
    if (datum < heap[0]) {
      heap[0]=datum;
      SortUtils.siftDown(heap,0,k - 1);
    }
  }
}

Fixed version (ground truth):
/** 
 * Assimilate a new value from the stream.
 */
public void add(double datum){
  sorted=false;
  if (n < k) {
    heap[n++]=datum;
    if (n == k) {
      sort(heap,k);
    }
  }
 else {
    n++;
    if (datum < heap[0]) {
      heap[0]=datum;
      SortUtils.siftDown(heap,0,k - 1);
    }
  }
}
Program: 92572
Project: 92572
Buggy source:
/** 
 * Returns the k-<i>th</i> smallest value seen so far.
 */
public double peek(){
  return heap[0];
}

Fixed version (ground truth):
/** 
 * Returns the k-<i>th</i> smallest value seen so far.
 */
public double peek(){
  if (n < k)   sort(heap,n);
  return heap[0];
}
Program: 92574
Project: 92574
Buggy source:
/** 
 * Test of learn method, of class CRF.
 */
@Test public void testLearnHyphenSparse(){
  System.out.println("String_Node_Str");
  IntDataset train=load("String_Node_Str");
  IntDataset test=load("String_Node_Str");
  CRF.Trainer trainer=new CRF.Trainer(train.p,train.k);
  trainer.setLearningRate(1.0);
  trainer.setMaximumLeafNodes(100);
  trainer.setNumIterations(100);
  CRF crf=trainer.train(train.x,train.y);
  int error=0;
  int n=0;
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        error++;
      }
    }
  }
  int viterbiError=0;
  crf.setViterbi(true);
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        viterbiError++;
      }
    }
  }
  System.out.format("String_Node_Str",error,n);
  System.out.format("String_Node_Str",100.0 * error / n);
  System.out.format("String_Node_Str",viterbiError,n);
  System.out.format("String_Node_Str",100.0 * viterbiError / n);
  assertEquals(461,error);
  assertEquals(462,viterbiError);
}

Fixed version (ground truth):
/** 
 * Test of learn method, of class CRF.
 */
@Test public void testLearnHyphenSparse(){
  System.out.println("String_Node_Str");
  IntDataset train=load("String_Node_Str");
  IntDataset test=load("String_Node_Str");
  CRF.Trainer trainer=new CRF.Trainer(train.p,train.k);
  trainer.setLearningRate(1.0);
  trainer.setMaxNodes(100);
  trainer.setNumTrees(100);
  CRF crf=trainer.train(train.x,train.y);
  int error=0;
  int n=0;
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        error++;
      }
    }
  }
  int viterbiError=0;
  crf.setViterbi(true);
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        viterbiError++;
      }
    }
  }
  System.out.format("String_Node_Str",error,n);
  System.out.format("String_Node_Str",100.0 * error / n);
  System.out.format("String_Node_Str",viterbiError,n);
  System.out.format("String_Node_Str",100.0 * viterbiError / n);
  assertEquals(461,error);
  assertEquals(462,viterbiError);
}
Program: 92575
Project: 92575
Buggy source:
/** 
 * Test of learn method, of class CRF.
 */
@Test public void testLearnProteinSparse(){
  System.out.println("String_Node_Str");
  IntDataset train=load("String_Node_Str");
  IntDataset test=load("String_Node_Str");
  CRF.Trainer trainer=new CRF.Trainer(train.p,train.k);
  trainer.setLearningRate(0.3);
  trainer.setMaximumLeafNodes(100);
  trainer.setNumIterations(100);
  CRF crf=trainer.train(train.x,train.y);
  int error=0;
  int n=0;
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        error++;
      }
    }
  }
  int viterbiError=0;
  crf.setViterbi(true);
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        viterbiError++;
      }
    }
  }
  System.out.format("String_Node_Str",error,n);
  System.out.format("String_Node_Str",100.0 * error / n);
  System.out.format("String_Node_Str",viterbiError,n);
  System.out.format("String_Node_Str",100.0 * viterbiError / n);
  assertEquals(1259,error);
  assertEquals(1377,viterbiError);
}

Fixed version (ground truth):
/** 
 * Test of learn method, of class CRF.
 */
@Test public void testLearnProteinSparse(){
  System.out.println("String_Node_Str");
  IntDataset train=load("String_Node_Str");
  IntDataset test=load("String_Node_Str");
  CRF.Trainer trainer=new CRF.Trainer(train.p,train.k);
  trainer.setLearningRate(0.3);
  trainer.setMaxNodes(100);
  trainer.setNumTrees(100);
  CRF crf=trainer.train(train.x,train.y);
  int error=0;
  int n=0;
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        error++;
      }
    }
  }
  int viterbiError=0;
  crf.setViterbi(true);
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        viterbiError++;
      }
    }
  }
  System.out.format("String_Node_Str",error,n);
  System.out.format("String_Node_Str",100.0 * error / n);
  System.out.format("String_Node_Str",viterbiError,n);
  System.out.format("String_Node_Str",100.0 * viterbiError / n);
  assertEquals(1259,error);
  assertEquals(1377,viterbiError);
}
Program: 92576
Project: 92576
Buggy source:
/** 
 * Test of learn method, of class CRF.
 */
@Test public void testLearnHyphen(){
  System.out.println("String_Node_Str");
  Dataset train=load("String_Node_Str",null);
  Dataset test=load("String_Node_Str",train.attributes);
  CRF.Trainer trainer=new CRF.Trainer(train.attributes,train.k);
  trainer.setLearningRate(1.0);
  trainer.setMaximumLeafNodes(100);
  trainer.setNumIterations(100);
  CRF crf=trainer.train(train.x,train.y);
  int error=0;
  int n=0;
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        error++;
      }
    }
  }
  int viterbiError=0;
  crf.setViterbi(true);
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        viterbiError++;
      }
    }
  }
  System.out.format("String_Node_Str",error,n);
  System.out.format("String_Node_Str",100.0 * error / n);
  System.out.format("String_Node_Str",viterbiError,n);
  System.out.format("String_Node_Str",100.0 * viterbiError / n);
  assertEquals(468,error);
  assertEquals(470,viterbiError);
}

Fixed version (ground truth):
/** 
 * Test of learn method, of class CRF.
 */
@Test public void testLearnHyphen(){
  System.out.println("String_Node_Str");
  Dataset train=load("String_Node_Str",null);
  Dataset test=load("String_Node_Str",train.attributes);
  CRF.Trainer trainer=new CRF.Trainer(train.attributes,train.k);
  trainer.setLearningRate(1.0);
  trainer.setMaxNodes(100);
  trainer.setNumTrees(100);
  CRF crf=trainer.train(train.x,train.y);
  int error=0;
  int n=0;
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        error++;
      }
    }
  }
  int viterbiError=0;
  crf.setViterbi(true);
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        viterbiError++;
      }
    }
  }
  System.out.format("String_Node_Str",error,n);
  System.out.format("String_Node_Str",100.0 * error / n);
  System.out.format("String_Node_Str",viterbiError,n);
  System.out.format("String_Node_Str",100.0 * viterbiError / n);
  assertEquals(468,error);
  assertEquals(470,viterbiError);
}
Program: 92577
Project: 92577
Buggy source:
/** 
 * Test of learn method, of class CRF.
 */
@Test public void testLearnProtein(){
  System.out.println("String_Node_Str");
  Dataset train=load("String_Node_Str",null);
  Dataset test=load("String_Node_Str",train.attributes);
  CRF.Trainer trainer=new CRF.Trainer(train.attributes,train.k);
  trainer.setLearningRate(0.3);
  trainer.setMaximumLeafNodes(100);
  trainer.setNumIterations(100);
  CRF crf=trainer.train(train.x,train.y);
  int error=0;
  int n=0;
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        error++;
      }
    }
  }
  int viterbiError=0;
  crf.setViterbi(true);
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        viterbiError++;
      }
    }
  }
  System.out.format("String_Node_Str",error,n);
  System.out.format("String_Node_Str",100.0 * error / n);
  System.out.format("String_Node_Str",viterbiError,n);
  System.out.format("String_Node_Str",100.0 * viterbiError / n);
  assertEquals(1253,error);
  assertEquals(1412,viterbiError);
}

Fixed version (ground truth):
/** 
 * Test of learn method, of class CRF.
 */
@Test public void testLearnProtein(){
  System.out.println("String_Node_Str");
  Dataset train=load("String_Node_Str",null);
  Dataset test=load("String_Node_Str",train.attributes);
  CRF.Trainer trainer=new CRF.Trainer(train.attributes,train.k);
  trainer.setLearningRate(0.3);
  trainer.setMaxNodes(100);
  trainer.setNumTrees(100);
  CRF crf=trainer.train(train.x,train.y);
  int error=0;
  int n=0;
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        error++;
      }
    }
  }
  int viterbiError=0;
  crf.setViterbi(true);
  for (int i=0; i < test.x.length; i++) {
    n+=test.x[i].length;
    int[] label=crf.predict(test.x[i]);
    for (int j=0; j < test.x[i].length; j++) {
      if (test.y[i][j] != label[j]) {
        viterbiError++;
      }
    }
  }
  System.out.format("String_Node_Str",error,n);
  System.out.format("String_Node_Str",100.0 * error / n);
  System.out.format("String_Node_Str",viterbiError,n);
  System.out.format("String_Node_Str",100.0 * viterbiError / n);
  assertEquals(1253,error);
  assertEquals(1412,viterbiError);
}
Program: 92580
Project: 92580
Buggy source:
/** 
 * Test of parse method, of class ArffParser.
 */
@Test public void testParseString() throws Exception {
  System.out.println("String_Node_Str");
  try {
    ArffParser arffParser=new ArffParser();
    AttributeDataset string=arffParser.parse(smile.data.parser.IOUtils.getDataFile("String_Node_Str"));
    double[][] x=string.toArray(new double[string.size()][]);
    for (    Attribute attribute : string.attributes()) {
      assertEquals(Attribute.Type.STRING,attribute.type);
    }
    Attribute[] attributes=string.attributes();
    assertEquals(5,string.size());
    assertEquals(2,attributes.length);
    assertEquals("String_Node_Str",attributes[0].toString(x[0][0]));
    assertEquals("String_Node_Str",attributes[1].toString(x[0][1]));
    assertEquals("String_Node_Str",attributes[0].toString(x[4][0]));
    assertEquals("String_Node_Str",attributes[1].toString(x[4][1]));
  }
 catch (  Exception ex) {
    System.err.println(ex);
  }
}

Fixed version (ground truth):
/** 
 * Test of parse method, of class ArffParser.
 */
@Test public void testParseString() throws Exception {
  System.out.println("String_Node_Str");
  try {
    ArffParser arffParser=new ArffParser();
    AttributeDataset string=arffParser.parse(smile.data.parser.IOUtils.getDataFile("String_Node_Str"));
    double[][] x=string.toArray(new double[string.size()][]);
    for (    Attribute attribute : string.attributes()) {
      assertEquals(Attribute.Type.STRING,attribute.getType());
    }
    Attribute[] attributes=string.attributes();
    assertEquals(5,string.size());
    assertEquals(2,attributes.length);
    assertEquals("String_Node_Str",attributes[0].toString(x[0][0]));
    assertEquals("String_Node_Str",attributes[1].toString(x[0][1]));
    assertEquals("String_Node_Str",attributes[0].toString(x[4][0]));
    assertEquals("String_Node_Str",attributes[1].toString(x[4][1]));
  }
 catch (  Exception ex) {
    System.err.println(ex);
  }
}
Program: 92581
Project: 92581
Buggy source:
/** 
 * Test of parse method, of class ArffParser.
 */
@Test public void testParseIris() throws Exception {
  System.out.println("String_Node_Str");
  try {
    ArffParser arffParser=new ArffParser();
    arffParser.setResponseIndex(4);
    AttributeDataset iris=arffParser.parse(smile.data.parser.IOUtils.getDataFile("String_Node_Str"));
    double[][] x=iris.toArray(new double[iris.size()][]);
    int[] y=iris.toArray(new int[iris.size()]);
    assertEquals(Attribute.Type.NOMINAL,iris.response().type);
    for (    Attribute attribute : iris.attributes()) {
      assertEquals(Attribute.Type.NUMERIC,attribute.type);
    }
    assertEquals(150,iris.size());
    assertEquals(4,iris.attributes().length);
    assertEquals("String_Node_Str",iris.response().toString(y[0]));
    assertEquals("String_Node_Str",iris.response().toString(y[1]));
    assertEquals("String_Node_Str",iris.response().toString(y[2]));
    assertEquals(5.1,x[0][0],1E-7);
    assertEquals(3.5,x[0][1],1E-7);
    assertEquals(1.4,x[0][2],1E-7);
    assertEquals(0.2,x[0][3],1E-7);
    assertEquals("String_Node_Str",iris.response().toString(y[149]));
    assertEquals(5.9,x[149][0],1E-7);
    assertEquals(3.0,x[149][1],1E-7);
    assertEquals(5.1,x[149][2],1E-7);
    assertEquals(1.8,x[149][3],1E-7);
  }
 catch (  Exception ex) {
    System.err.println(ex);
  }
}

Fixed version (ground truth):
/** 
 * Test of parse method, of class ArffParser.
 */
@Test public void testParseIris() throws Exception {
  System.out.println("String_Node_Str");
  try {
    ArffParser arffParser=new ArffParser();
    arffParser.setResponseIndex(4);
    AttributeDataset iris=arffParser.parse(smile.data.parser.IOUtils.getDataFile("String_Node_Str"));
    double[][] x=iris.toArray(new double[iris.size()][]);
    int[] y=iris.toArray(new int[iris.size()]);
    assertEquals(Attribute.Type.NOMINAL,iris.response().getType());
    for (    Attribute attribute : iris.attributes()) {
      assertEquals(Attribute.Type.NUMERIC,attribute.getType());
    }
    assertEquals(150,iris.size());
    assertEquals(4,iris.attributes().length);
    assertEquals("String_Node_Str",iris.response().toString(y[0]));
    assertEquals("String_Node_Str",iris.response().toString(y[1]));
    assertEquals("String_Node_Str",iris.response().toString(y[2]));
    assertEquals(5.1,x[0][0],1E-7);
    assertEquals(3.5,x[0][1],1E-7);
    assertEquals(1.4,x[0][2],1E-7);
    assertEquals(0.2,x[0][3],1E-7);
    assertEquals("String_Node_Str",iris.response().toString(y[149]));
    assertEquals(5.9,x[149][0],1E-7);
    assertEquals(3.0,x[149][1],1E-7);
    assertEquals(5.1,x[149][2],1E-7);
    assertEquals(1.8,x[149][3],1E-7);
  }
 catch (  Exception ex) {
    System.err.println(ex);
  }
}
Program: 92582
Project: 92582
Buggy source:
/** 
 * Test of parse method, of class DelimitedTextParser.
 */
@Test public void testParse() throws Exception {
  System.out.println("String_Node_Str");
  try {
    DelimitedTextParser parser=new DelimitedTextParser();
    parser.setResponseIndex(new NominalAttribute("String_Node_Str"),0);
    AttributeDataset usps=parser.parse("String_Node_Str",smile.data.parser.IOUtils.getDataFile("String_Node_Str"));
    double[][] x=usps.toArray(new double[usps.size()][]);
    int[] y=usps.toArray(new int[usps.size()]);
    assertEquals(Attribute.Type.NOMINAL,usps.response().type);
    for (    Attribute attribute : usps.attributes()) {
      assertEquals(Attribute.Type.NUMERIC,attribute.type);
    }
    assertEquals(7291,usps.size());
    assertEquals(256,usps.attributes().length);
    assertEquals("String_Node_Str",usps.response().toString(y[0]));
    assertEquals("String_Node_Str",usps.response().toString(y[1]));
    assertEquals("String_Node_Str",usps.response().toString(y[2]));
    assertEquals(-1.0000,x[0][6],1E-7);
    assertEquals(-0.6310,x[0][7],1E-7);
    assertEquals(0.8620,x[0][8],1E-7);
    assertEquals("String_Node_Str",usps.response().toString(y[7290]));
    assertEquals(-1.0000,x[7290][4],1E-7);
    assertEquals(-0.1080,x[7290][5],1E-7);
    assertEquals(1.0000,x[7290][6],1E-7);
  }
 catch (  Exception ex) {
    System.err.println(ex);
  }
}

Fixed version (ground truth):
/** 
 * Test of parse method, of class DelimitedTextParser.
 */
@Test public void testParse() throws Exception {
  System.out.println("String_Node_Str");
  try {
    DelimitedTextParser parser=new DelimitedTextParser();
    parser.setResponseIndex(new NominalAttribute("String_Node_Str"),0);
    AttributeDataset usps=parser.parse("String_Node_Str",smile.data.parser.IOUtils.getDataFile("String_Node_Str"));
    double[][] x=usps.toArray(new double[usps.size()][]);
    int[] y=usps.toArray(new int[usps.size()]);
    assertEquals(Attribute.Type.NOMINAL,usps.response().getType());
    for (    Attribute attribute : usps.attributes()) {
      assertEquals(Attribute.Type.NUMERIC,attribute.getType());
    }
    assertEquals(7291,usps.size());
    assertEquals(256,usps.attributes().length);
    assertEquals("String_Node_Str",usps.response().toString(y[0]));
    assertEquals("String_Node_Str",usps.response().toString(y[1]));
    assertEquals("String_Node_Str",usps.response().toString(y[2]));
    assertEquals(-1.0000,x[0][6],1E-7);
    assertEquals(-0.6310,x[0][7],1E-7);
    assertEquals(0.8620,x[0][8],1E-7);
    assertEquals("String_Node_Str",usps.response().toString(y[7290]));
    assertEquals(-1.0000,x[7290][4],1E-7);
    assertEquals(-0.1080,x[7290][5],1E-7);
    assertEquals(1.0000,x[7290][6],1E-7);
  }
 catch (  Exception ex) {
    System.err.println(ex);
  }
}
Program: 92583
Project: 92583
Buggy source:
/** 
 * Test of parse method, of class GCTParser.
 */
@Test public void testParse() throws Exception {
  System.out.println("String_Node_Str");
  GCTParser parser=new GCTParser();
  try {
    AttributeDataset data=parser.parse("String_Node_Str",smile.data.parser.IOUtils.getDataFile("String_Node_Str"));
    double[][] x=data.toArray(new double[data.size()][]);
    String[] id=data.toArray(new String[data.size()]);
    for (    Attribute attribute : data.attributes()) {
      assertEquals(Attribute.Type.NUMERIC,attribute.type);
      System.out.println(attribute.name);
    }
    assertEquals(12564,data.size());
    assertEquals(48,data.attributes().length);
    assertEquals("String_Node_Str",id[0]);
    assertEquals(-161.8,x[0][0],1E-7);
    assertEquals(-231.0,x[0][1],1E-7);
    assertEquals(-279.0,x[0][2],1E-7);
    assertEquals("String_Node_Str",id[12563]);
    assertEquals(95.0,x[12563][45],1E-7);
    assertEquals(108.0,x[12563][46],1E-7);
    assertEquals(346.0,x[12563][47],1E-7);
  }
 catch (  Exception ex) {
    System.err.println(ex);
  }
}

Fixed version (ground truth):
/** 
 * Test of parse method, of class GCTParser.
 */
@Test public void testParse() throws Exception {
  System.out.println("String_Node_Str");
  GCTParser parser=new GCTParser();
  try {
    AttributeDataset data=parser.parse("String_Node_Str",smile.data.parser.IOUtils.getDataFile("String_Node_Str"));
    double[][] x=data.toArray(new double[data.size()][]);
    String[] id=data.toArray(new String[data.size()]);
    for (    Attribute attribute : data.attributes()) {
      assertEquals(Attribute.Type.NUMERIC,attribute.getType());
      System.out.println(attribute.getName());
    }
    assertEquals(12564,data.size());
    assertEquals(48,data.attributes().length);
    assertEquals("String_Node_Str",id[0]);
    assertEquals(-161.8,x[0][0],1E-7);
    assertEquals(-231.0,x[0][1],1E-7);
    assertEquals(-279.0,x[0][2],1E-7);
    assertEquals("String_Node_Str",id[12563]);
    assertEquals(95.0,x[12563][45],1E-7);
    assertEquals(108.0,x[12563][46],1E-7);
    assertEquals(346.0,x[12563][47],1E-7);
  }
 catch (  Exception ex) {
    System.err.println(ex);
  }
}