Click or drag to resize

CrossEntropyContextPartialSample Method

Draws the specified subset of a sample from a distribution characterized by the given parameter, using the stated random number generator. Used when executing the sampling step of a CrossEntropyProgram running in this context.

Namespace:  Novacta.Analytics.Advanced
Assembly:  Novacta.Analytics (in Novacta.Analytics.dll) Version: 2.0.0
Syntax
protected abstract void PartialSample(
	double[] destinationArray,
	Tuple<int, int> sampleSubsetRange,
	RandomNumberGenerator randomNumberGenerator,
	DoubleMatrix parameter,
	int sampleSize
)

Parameters

destinationArray
Type: SystemDouble
The destination array that receives the overall sampled data.
sampleSubsetRange
Type: SystemTupleInt32, Int32
The range specifying the subset of sampled points to draw.
randomNumberGenerator
Type: Novacta.AnalyticsRandomNumberGenerator
The random number generator exploited to sample.
parameter
Type: Novacta.AnalyticsDoubleMatrix
The parameter characterizing the probability distribution from which the sample subset must be drawn.
sampleSize
Type: SystemInt32
The overall sample size.
Remarks

Class CrossEntropyProgram can run in parallel the generation of the points in the sampling step of the Cross-Entropy program. Such generations can be carried out efficiently in parallel, since the sampled points are assumed to be statistically independent. The points are represented by the rows of the matrix returned by method Sample(CrossEntropyContext, Int32, DoubleMatrix). The matrix has sampleSize rows and a number of columns equal to the StateDimension of the system under study. Parameter destinationArray must be interpreted as a ColumnMajor ordered, Dense representation of such matrix.

To enable parallel sampling procedures, the collection of row indexes of such matrix are partitioned, and each part is assigned to a thread in a specific pool for processing. Method SubSample is called when sampling locally to a given thread in the pool, and receives the range of points to be sampled in the current thread through parameter sampleSubsetRange. Each item in the range must thus be a valid row index for the matrix returned by Sample, which implies that it must be nonnegative and less than the size of the sample, sampleSize.

Ranges are represented as TupleT1, T2 instances, and must be interpreted as Item1 included, Item2 excluded ranges. When called, it is expected that the method will fill the rows of the sample matrix corresponding to the indexes inside the range. More thoroughly, let LaTeX equation be Item1 and LaTeX equation be Item2, and let LaTeX equation and LaTeX equation represent, respectively, StateDimension and sampleSize. Then, for LaTeX equation and LaTeX equation, this method is expected to fill the LaTeX equation-th position of destinationArray with the LaTeX equation-th component of the LaTeX equation-th sampled point.

The method also receive a random number generator which is local to the current thread. You should not use generators other than this in the body of this method. In fact, a distinct random number generator is assigned to whatever thread was scheduled to execute SubSample. Such generators are recycled together with their corresponding threads, and are statistically mutually independent.

See Also