class LaplaceDistributionMaximumLikelihoodEstimator extends DistributionParameterEstimator<Double> {

  @Override
  public ProbabilityDistribution<Double> evaluate(final double[] x) {
    Validate.notNull(x, "x");
    ArgumentChecker.notEmpty(x, "x");
    final double median = _median.evaluate(x);
    final int n = x.length;
    double b = 0;
    for (int i = 0; i < n; i++) {
      b += Math.abs(x[i] - median);
    }
    return new LaplaceDistribution(median, b / n);
  }

}