Skip to content

Instantly share code, notes, and snippets.

@josep2
Created December 19, 2016 16:17
Show Gist options
  • Save josep2/b7c5ae98533a734471a66fee70c42331 to your computer and use it in GitHub Desktop.
Save josep2/b7c5ae98533a734471a66fee70c42331 to your computer and use it in GitHub Desktop.
def harmonicMean(values: Seq[Double]): Double = {
values.length / values.map(v => 1.0 / v).sum
}
// Borrowed from: https://github.com/Leksyk/ml/blob/3d2c8ede6ff99d8c6ec3f830e6a4c49b85ee8e82/similar-words/src/main/scala/Utils.scala
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment