Search in sources :

Example 1 with FittingFunction

use of de.lmu.ifi.dbs.elki.math.linearalgebra.fitting.FittingFunction in project elki by elki-project.

the class KernelDensityFittingTest method run.

private double[] run(double[] data, double[] params) {
    FittingFunction func = GaussianFittingFunction.STATIC;
    boolean[] dofit = { true, true, true };
    KernelDensityEstimator de = new KernelDensityEstimator(data, GaussianKernelDensityFunction.KERNEL, 1e-10);
    LevenbergMarquardtMethod fit = new LevenbergMarquardtMethod(func, params, dofit, data, de.getDensity(), de.getVariance());
    // for(int i = 0; i < 100; i++) {
    // fit.iterate();
    // double[] ps = fit.getParams();
    // System.out.println("Mean: " + ps[0] + " Stddev: " + ps[1] + " Amp: " +
    // ps[2]+" Chi: "+fit.getChiSq());
    // }
    fit.run();
    // "+fit.getChiSq()+" Iter: "+fit.maxruns);
    return fit.getParams();
}
Also used : FittingFunction(de.lmu.ifi.dbs.elki.math.linearalgebra.fitting.FittingFunction) GaussianFittingFunction(de.lmu.ifi.dbs.elki.math.linearalgebra.fitting.GaussianFittingFunction) LevenbergMarquardtMethod(de.lmu.ifi.dbs.elki.math.linearalgebra.fitting.LevenbergMarquardtMethod) KernelDensityEstimator(de.lmu.ifi.dbs.elki.math.statistics.KernelDensityEstimator)

Aggregations

FittingFunction (de.lmu.ifi.dbs.elki.math.linearalgebra.fitting.FittingFunction)1 GaussianFittingFunction (de.lmu.ifi.dbs.elki.math.linearalgebra.fitting.GaussianFittingFunction)1 LevenbergMarquardtMethod (de.lmu.ifi.dbs.elki.math.linearalgebra.fitting.LevenbergMarquardtMethod)1 KernelDensityEstimator (de.lmu.ifi.dbs.elki.math.statistics.KernelDensityEstimator)1