Commit 0cc11899 authored by Juste Raimbault's avatar Juste Raimbault
Browse files

[Tool] Fix StatisticsPackage structure

parent e26f9be1
package org.openmole.tool.statistics
import org.openmole.tool.types.ToDouble
trait StatisticsPackage extends Stat { stat
implicit class StatisticIterableOfDoubleDecorator[T](s: Seq[T])(implicit td: ToDouble[T]) {
def median: Double = stat.median(s.map(td.apply))
def medianAbsoluteDeviation = stat.medianAbsoluteDeviation(s.map(td.apply))
def average = stat.average(s.map(td.apply))
def variance = stat.variance(s.map(td.apply))
def meanSquaredError = stat.meanSquaredError(s.map(td.apply))
def standardDeviation = stat.standardDeviation(s.map(td.apply))
def rootMeanSquaredError = stat.rootMeanSquaredError(s.map(td.apply))
def normalize = stat.normalize(s.map(td.apply))
def absoluteDistance[T2](to: Seq[T2])(implicit td2: ToDouble[T2]) = stat.absoluteDistance(s.map(td.apply), to.map(td2.apply))
def squareDistance[T2](to: Seq[T2])(implicit td2: ToDouble[T2]) = stat.squareDistance(s.map(td.apply), to.map(td2.apply))
def dynamicTimeWarpingDistance[T2](to: Seq[T2], fast: Boolean = true)(implicit td2: ToDouble[T2]) = stat.dynamicTimeWarpingDistance(s.map(td.apply), to.map(td2.apply))
}
implicit def statisticArrayOfDoubleDecorator[T: ToDouble](s: Array[T]) = new StatisticIterableOfDoubleDecorator(s.toVector)
}
......@@ -16,31 +16,4 @@
*/
package org.openmole.tool
package statistics {
import org.openmole.tool.types.ToDouble
trait StatisticsPackage extends Stat { stat
implicit class StatisticIterableOfDoubleDecorator[T](s: Seq[T])(implicit td: ToDouble[T]) {
def median: Double = stat.median(s.map(td.apply))
def medianAbsoluteDeviation = stat.medianAbsoluteDeviation(s.map(td.apply))
def average = stat.average(s.map(td.apply))
def variance = stat.variance(s.map(td.apply))
def meanSquaredError = stat.meanSquaredError(s.map(td.apply))
def standardDeviation = stat.standardDeviation(s.map(td.apply))
def rootMeanSquaredError = stat.rootMeanSquaredError(s.map(td.apply))
def normalize = stat.normalize(s.map(td.apply))
def absoluteDistance[T2](to: Seq[T2])(implicit td2: ToDouble[T2]) = stat.absoluteDistance(s.map(td.apply), to.map(td2.apply))
def squareDistance[T2](to: Seq[T2])(implicit td2: ToDouble[T2]) = stat.squareDistance(s.map(td.apply), to.map(td2.apply))
def dynamicTimeWarpingDistance[T2](to: Seq[T2], fast: Boolean = true)(implicit td2: ToDouble[T2]) = stat.dynamicTimeWarpingDistance(s.map(td.apply), to.map(td2.apply))
}
implicit def statisticArrayOfDoubleDecorator[T: ToDouble](s: Array[T]) = new StatisticIterableOfDoubleDecorator(s.toVector)
}
}
package object statistics extends StatisticsPackage
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment