Example usage for org.apache.commons.math.analysis.interpolation LoessInterpolator smooth

List of usage examples for org.apache.commons.math.analysis.interpolation LoessInterpolator smooth

Introduction

In this page you can find the example usage for org.apache.commons.math.analysis.interpolation LoessInterpolator smooth.

Prototype

public final double[] smooth(final double[] xval, final double[] yval) throws MathException 

Source Link

Document

Compute a loess fit on the data at the original abscissae.

Usage

From source file:guineu.modules.filter.Alignment.SerumHuNormalization.SerumHuNormalizationTask.java

private PolynomialSplineFunction createCurve() {
    try {/*  w w w .j av a2 s  . co m*/
        // if there are more than 2 points in the model
        LoessInterpolator loess = null;
        if (this.loessBandwidth == 0 && this.iterations == 0) {
            loess = new LoessInterpolator();
        } else {
            loess = new LoessInterpolator(this.loessBandwidth, this.iterations);
        }
        double[] newy = loess.smooth(xval, yval);
        PolynomialSplineFunction function = loess.interpolate(xval, newy);
        return function;

    } catch (MathException ex) {
        Logger.getLogger(SerumHuNormalizationTask.class.getName()).log(Level.SEVERE, null, ex);

        SplineInterpolator loess = new SplineInterpolator();
        PolynomialSplineFunction function = loess.interpolate(xval, yval);
        return function;

    }
}