gov.sandia.cognition.statistics.montecarlo.DirectSampler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cognitive-foundry Show documentation
Show all versions of cognitive-foundry Show documentation
A single jar with all the Cognitive Foundry components.
/*
* File: DirectSampler.java
* Authors: Kevin R. Dixon
* Company: Sandia National Laboratories
* Project: Cognitive Foundry
*
* Copyright Feb 11, 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.statistics.montecarlo;
import gov.sandia.cognition.statistics.ProbabilityFunction;
import gov.sandia.cognition.util.AbstractCloneableSerializable;
import java.util.ArrayList;
import java.util.Random;
/**
* Sampler that generates samples directly from a target distribution.
* @param Type of data to sample.
* @author Kevin R. Dixon
* @since 3.0
*/
public class DirectSampler
extends AbstractCloneableSerializable
implements MonteCarloSampler>
{
/**
* Creates a new instance of DirectSampler
*/
public DirectSampler()
{
}
public ArrayList extends DataType> sample(
ProbabilityFunction targetFunction,
Random random,
int numSamples)
{
return targetFunction.sample(random, numSamples);
}
}