1.1. Base

Base classes for all estimators. Class definition for Individual, the base class for all surrogate models.

1.1.1. SurrogateModel

class surrogate.base.SurrogateModel[source]

A class for surrogate models.

Individual

fit(x, y)[source]

fit ML model

Parameters:
  • x – training dataset
  • y – training dataset
Returns:

void

1.1.2. MultiFiSurrogateModel

class surrogate.base.MultiFiSurrogateModel[source]

Base class for surrogate models using multi-fiddelity training data

Parameters:SurrogateModel – Object
fit(x, y)[source]

fit ML model

Parameters:
  • x – training dataset
  • y – training dataset
Returns:

void

1.1.3. Individual

class surrogate.base.Individual(estimator[, variable, constraint, weights])[source]

A Individual

Fitness

Parameters:estimator – physical based model
__init__(estimator, variable=None, constraint=None, weights=())[source]
Parameters:
  • estimator
  • variable
  • constraint
  • weights
Returns:

__weakref__

list of weak references to the object (if defined)

getVar(i)[source]

The fitness is a measure of quality of a solution. If values are provided as a tuple, the fitness is initalized using those values, otherwise it is empty (or invalid).

Parameters:i – index of variable
if not (isinstance(i, int) and i >= 0):
    raise ValueError("Variable index must be an integer >= 0 .")

Note

Note

1.1.4. Fitness

class surrogate.base.Fitness([values])[source]

The fitness is a measure of quality of a solution. If values are provided as a tuple, the fitness is initalized using those values, otherwise it is empty (or invalid).

Parameters:values – The initial values of the fitness as a tuple, optional.

Fitnesses may be compared using the >, <, >=, <=, ==, !=. The comparison of those operators is made lexicographically. Maximization and minimization are taken care off by a multiplication between the weights and the fitness values. The comparison can be made between fitnesses of different size, if the fitnesses are equal until the extra elements, the longer fitness will be superior to the shorter.

Different types of fitnesses.

Note

When comparing fitness values that are minimized, a > b will return True if a is smaller than b.

__eq__(other)[source]

x.__eq__(y) <==> x==y

__ge__(other)[source]

x.__ge__(y) <==> x>=y

__gt__(other)[source]

x.__gt__(y) <==> x>y

__hash__()[source]

hash

Returns:
__init__(values=(), weights=())[source]

x.__init__(…) initializes x; see help(type(x)) for signature

__le__(other)[source]

x.__le__(y) <==> x<=y

__lt__(other)[source]

x.__lt__(y) <==> x<y

__ne__(other)[source]

x.__ne__(y) <==> x!=y

__repr__()[source]

Return the Python code to build a copy of the object.

__str__()[source]

Return the values of the Fitness object.

__weakref__

list of weak references to the object (if defined)

dominates(other, obj=slice(None, None, None))[source]

Return true if each objective of self is not strictly worse than the corresponding objective of other and at least one objective is strictly better.

Parameters:obj – Slice indicating on which objectives the domination is tested. The default value is slice(None), representing every objectives.
valid

Assess if a fitness is valid or not.

values

Fitness values. Use directly individual.fitness.values = values in order to set the fitness and del individual.fitness.values in order to clear (invalidate) the fitness. The (unweighted) fitness can be directly accessed via individual.fitness.values.

weights = None

The weights are used in the fitness comparison. They are shared among all fitnesses of the same type. When subclassing Fitness, the weights must be defined as a tuple where each element is associated to an objective. A negative weight element corresponds to: (-1.0, -1.0) the minimization of the associated objective. A positive weight element corresponds to: (1.0, 1.0) the maximization of the associated objective.

Note

If weights is not defined during subclassing, the following error will occur at instantiation of a subclass fitness object:

TypeError: Can't instantiate abstract <class Fitness[...]> with abstract attribute weights.

wvalues = ()

Contains the weighted values of the fitness, the multiplication with the weights is made when the values are set via the property values. Multiplication is made on setting of the values for efficiency.

Generally it is unnecessary to manipulate wvalues as it is an internal attribute of the fitness used in the comparison operators.