All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gov.sandia.cognition.learning.function.cost.KolmogorovSmirnovDivergence Maven / Gradle / Ivy

There is a newer version: 4.0.1
Show newest version
/*
 * File:                KolmogorovSmirnovDivergence.java
 * Authors:             Kevin R. Dixon
 * Company:             Sandia National Laboratories
 * Project:             Cognitive Foundry
 * 
 * Copyright Jul 12, 2010, Sandia Corporation.
 * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
 * license for use of this work by or on behalf of the U.S. Government.
 * Export of this program may require a license from the United States
 * Government. See CopyrightHistory.txt for complete details.
 * 
 */

package gov.sandia.cognition.learning.function.cost;

import gov.sandia.cognition.statistics.CumulativeDistributionFunction;
import gov.sandia.cognition.statistics.UnivariateDistribution;
import gov.sandia.cognition.statistics.method.KolmogorovSmirnovConfidence;
import java.util.Collection;

/**
 * CostFunction that induces a CDF that most-closely resembles the
 * target distribution according to the Kolmogorov-Smirnov (K-S) test.
 * @param 
 * Type of data generated by the Distribution
 */
public class KolmogorovSmirnovDivergence
    extends AbstractCostFunction,Collection>
{

    /**
     * Default constructor
     */
    public KolmogorovSmirnovDivergence()
    {
        this( null );
    }

    /**
     * Creates a new instance of KolmogorovSmirnovDivergence
     * @param costParameters
     * Data generated by the target distribution
     */
    public KolmogorovSmirnovDivergence(
        Collection costParameters)
    {
        super( costParameters );
    }

    @Override
    public Double evaluate(
        UnivariateDistribution target)
    {

        CumulativeDistributionFunction cdf = target.getCDF();
        KolmogorovSmirnovConfidence.Statistic kstest =
            KolmogorovSmirnovConfidence.evaluateNullHypothesis(
                this.getCostParameters(),cdf);
        double d = kstest.getD();
        return d;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy