Rectangular

The RectangularStrata class is imported using the following command:

>>> from UQpy.sampling.stratified_sampling.strata.RectangularStrata import RectangularStrata

Methods

class RectangularStrata(strata_number=None, input_file=None, seeds=None, widths=None, random_state=None, sampling_criterion=SamplingCriterion.RANDOM)[source]
Parameters:
  • strata_number (Union[int, list[int], None]) – A list of length \(n\) defining the number of strata in each of the \(n\) dimensions. Creates an equal stratification with strata widths equal to 1/strata_number. The total number of strata, \(N\), is the product of the terms of strata_number.

  • input_file (Optional[str]) – File path to an input file specifying stratum seeds and stratum widths. This is typically used to define irregular stratified designs. The user must pass one of strata_number OR input_file OR seeds and widths

  • seeds (Optional[ndarray]) – An array of dimension \(N * n\) specifying the seeds of all strata. The seeds of the strata are the coordinates of the stratum orthotope nearest the global origin.

  • widths – An array of dimension \(N * n\) specifying the widths of all strata in each dimension

  • sampling_criterion (SamplingCriterion) – An enumeration of type StratificationCriterion defining the stratification type

Example:

A 2-dimensional stratification with 2 strata in each dimension widths = [[0.5, 0.5], [0.5, 0.5], [0.5, 0.5], [0.5, 0.5]]

Example: strata_number = [2, 3, 2] creates a 3-dimensional stratification with:

2 strata in dimension 0 with stratum widths 1/2

3 strata in dimension 1 with stratum widths 1/3

2 strata in dimension 2 with stratum widths 1/2

The user must pass one of strata_number OR input_file OR seeds and widths

stratify()[source]

Performs the rectangular stratification.

static fullfact(levels)[source]

Create a full-factorial design

Parameters:

levels – A list of integers that indicate the number of levels of each input design factor.

Returns:

Full-factorial design matrix.

Note: This function has been modified from pyDOE, released under BSD License (3-Clause)

Copyright (C) 2012 - 2013 - Michael Baudin

Copyright (C) 2012 - Maria Christopoulou

Copyright (C) 2010 - 2011 - INRIA - Michael Baudin

Copyright (C) 2009 - Yann Collette

Copyright (C) 2009 - CEA - Jean-Marc Martinez

Original source code can be found at:

https://pythonhosted.org/pyDOE/#

or

https://pypi.org/project/pyDOE/

or

https://github.com/tisimst/pyDOE/

plot_2d()[source]

Plot the rectangular stratification.

This is an instance method of the Rectangular class that can be called to plot the boundaries of a two-dimensional Rectangular object on \([0, 1]^2\).

Attributes

RectangularStrata.strata_number: int

A list of length n defining the number of strata in each of the n dimensions. Creates an equal stratification with strata widths equal to 1/strata_number. The total number of strata, \(N\), is the product of the terms of strata_number.

RectangularStrata.widths: ndarray

An array of dimension \(N * n\) specifying the widths of all strata in each dimension.