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(self)

Generate points according to the type of the experiment.

getClassName(self)

Accessor to the object’s name.

getId(self)

Accessor to the object’s id.

getImplementation(self)

Accessor to the underlying implementation.

getName(self)

Accessor to the object’s name.

setImplementation(self, p_implementation)

Accessor to the underlying implementation.

setName(self, name)

Accessor to the object’s name.

__init__(self, \*args)

Initialize self. See help(type(self)) for accurate signature.

generate(self)

Generate points according to the type of the experiment.

Returns
sampleSample

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(self)

Accessor to the object’s name.

Returns
class_namestr

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

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getImplementation(self)

Accessor to the underlying implementation.

Returns
implImplementation

The implementation class.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

setImplementation(self, p_implementation)

Accessor to the underlying implementation.

Parameters
implementationExperimentImplementation

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(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.