Strata Class

The Strata class is imported using the following command:

>>> from UQpy.sampling.stratified_sampling.strata.baseclass.Strata import Strata

The Strata class is the parent class that defines the geometric decomposition of the parameter space. All geometric decompositions in the Strata class are performed on the n-dimensional unit \([0, 1]^n\) hypercube. Specific stratifications are performed by subclassing the Strata class. There are currently three stratifications available in the Strata class, defined through the subclasses Rectangular, Voronoi, and Delaunay.

Methods

class Strata(seeds=None, random_state=None)[source]

Define a geometric decomposition of the n-dimensional unit hypercube into disjoint and space-filling strata.

This is the parent class for all spatial stratified_sampling. This parent class only provides the framework for stratification and cannot be used directly for the stratification. Stratification is done by calling the child class for the desired stratification.

Parameters:

seeds (Optional[ndarray]) – Define the seed points for the strata. See specific subclass for definition of the seed points.

abstract stratify()[source]

Perform the stratification of the unit hypercube. It is overwritten by the subclass. This method must exist in any subclass of the Strata class.

abstract sample_strata(nsamples_per_stratum, random_state)[source]

Abstract class that need to be implemented in each new Stratum. It defines a way to draw samples from each stratum.

Parameters:
  • nsamples_per_stratum – Number of samples to draw in each stratum

  • random_state – Random seed used to initialize the pseudo-random number generator. Default is None. If an int is provided, this sets the seed for an object of numpy.random.RandomState. Otherwise, the object itself can be passed directly.

Returns:

A tuple containing the new samples contained in the strata as well as their corresponding weights.

abstract calculate_strata_metrics(index)[source]

Abstract method that calculates stratum metrics needed in order for the sampling algorithm to decide which stratum to refine

Parameters:

index – Stratum index

Returns:

A list containing the metric of each stratum.

Attributes

Strata.seeds: ndarray

Seed points for the strata. See specific subclass for definition of the seed points.

Strata.volume: ndarray

An array of dimension (strata_number, ) containing the volume of each stratum.