Skip to content

Instantly share code, notes, and snippets.

@hack-r
Created January 31, 2017 15:41
Show Gist options
  • Save hack-r/d028f2709d7aeb75e65f272e17827ebe to your computer and use it in GitHub Desktop.
Save hack-r/d028f2709d7aeb75e65f272e17827ebe to your computer and use it in GitHub Desktop.
String[] outPut = new String[2];
for (int j = 0; j < newTest.size(); j++){
double[] predictionDistribution = clf.distributionForInstance(newTest.instance(j));
for(int i=0; i<predictionDistribution.length; i=i+1){
outPut[i] = "Probability of class "+
newTest.classAttribute().value(i)+
" : "+Double.toString(predictionDistribution[i]);
}
}
System.out.println("Predictions complete! Writing output file to csv...");
// Save results in .csv file
//outFile.write(builder.toString());//save the string representation
outFile.write(outPut.toString());
System.out.println("Output file written.");
System.out.println("SilverBullet RRO completed successfully!");
outFile.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment