Experiment

class Experiment(*args)

Base class for design of experiments.

Considering \vect{x}=x^1,\dots, x^n a vector of input parameters, this class is used to determine a particular set of values of \vect{x} according to a particular design of experiments.

Different types of design of experiments can be determined:

  • some stratified patterns: axial, composite, factorial or box patterns,
  • some weighted patterns that we can split into different categories: the random patterns, the low discrepancy sequences and the deterministic patterns.

Examples

Define a custom design of experiment: >>> import openturns as ot >>> ot.RandomGenerator.SetSeed(0) >>> class RandomExp(object): … def generate(self): … return ot.Normal(1).getSample(10) >>> experiment = ot.Experiment(RandomExp()) >>> sample = experiment.generate()

Methods

generate() Generate points according to the type of the experiment.
getClassName() Accessor to the object’s name.
getId() Accessor to the object’s id.
getImplementation(*args) Accessor to the underlying implementation.
getName() Accessor to the object’s name.
setImplementation(p_implementation) Accessor to the underlying implementation.
setName(name) Accessor to the object’s name.
__init__(*args)
generate()

Generate points according to the type of the experiment.

Returns:

sample : Sample

The points which constitute the design of experiments. The sampling method is defined by the nature of the experiment.

Examples

>>> import openturns as ot
>>> ot.RandomGenerator.SetSeed(0)
>>> myExperiment = ot.Experiment(ot.MonteCarloExperiment(ot.Normal(2),5))
>>> print(myExperiment.generate())
    [ X0        X1        ]
0 : [  0.608202 -1.26617  ]
1 : [ -0.438266  1.20548  ]
2 : [ -2.18139   0.350042 ]
3 : [ -0.355007  1.43725  ]
4 : [  0.810668  0.793156 ]
getClassName()

Accessor to the object’s name.

Returns:

class_name : str

The object class name (object.__class__.__name__).

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getImplementation(*args)

Accessor to the underlying implementation.

Returns:

impl : Implementation

The implementation class.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

setImplementation(p_implementation)

Accessor to the underlying implementation.

Parameters:

implementation : ExperimentImplementation

An ExperimentImplementation object.

Examples

>>> import openturns as ot
>>> myExperiment = ot.Experiment(ot.MonteCarloExperiment(ot.Normal(2),5))
>>> myExperimentImplementation = myExperiment.getImplementation()
>>> mySecondExperiment = ot.Experiment()
>>> mySecondExperiment.setImplementation(myExperimentImplementation)
setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.