Skip to content

Instantly share code, notes, and snippets.

@Jacoby6000
Forked from zeryx/working_formatter.scala
Created January 17, 2017 21:39
Show Gist options
  • Save Jacoby6000/0719e0ff82a88cf88c6d41c850a097de to your computer and use it in GitHub Desktop.
Save Jacoby6000/0719e0ff82a88cf88c6d41c850a097de to your computer and use it in GitHub Desktop.
val formattedPredictions: List[Option[String]] = predictions.map(_.classPredictions.headOption.map(_.prediction))
val formattedLabels: List[Option[String]] = data.map(_.label)
val (guesses, truths): (List[String], List[String]) = (
for {
(guess, truth) <- formattedPredictions zip formattedLabels
realGuess <- guess
realTruth <- truth
}yield(realGuess, realTruth)
).unzip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment