Skip to content

Instantly share code, notes, and snippets.

@sanity
Created November 23, 2011 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sanity/1389799 to your computer and use it in GitHub Desktop.
Save sanity/1389799 to your computer and use it in GitHub Desktop.
final LinkedList<PredictionCalibrator.Prediction> predictions = Lists.newLinkedList();
for (int x = 0; x < 10000; x++) {
final double prediction = Misc.random.nextDouble();
final double outcome = (Misc.random.nextDouble() < Math.pow(prediction, 2)) ? 1.0 : 0.0;
predictions.add(new Prediction(prediction, outcome));
}
final PredictionCalibrator pc = new PredictionCalibrator(predictions);
for (final Prediction p : pc.calibrationSet) {
System.out.println(p.prediction + "\t" + p.outcome);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment