PythonActiveLearningReliabilityFunction¶
- class PythonActiveLearningReliabilityFunction(reliabilityThreshold, learningThreshold)¶
Allow one to override ActiveLearningReliabilityFunction from Python.
- Parameters:
- reliabilityThresholdfloat
Threshold of the reliability event.
- learningThresholdfloat
Threshold used to check the active learning convergence.
Methods
checkConvergenceLearning(criterionValues)Test convergence of active learning.
Pointwise score, looped over by the default __call__.
Gaussian process result accessor.
getInfillSample(candidateSample, criterionValues)Select the infill sample, defaults to the optimizer of the criterion values.
Learning threshold accessor.
Reliability threshold accessor.
Selection direction: True if the infill point maximizes the criterion.
setGaussianProcessRegression(gprResult)Gaussian process result accessor, set by the algorithm at each iteration.
setLearningThreshold(learningThreshold)Learning threshold accessor.
setReliabilityThreshold(reliabilityThreshold)Reliability threshold accessor.
Notes
You must at least overload the methods computeAsScalar or __call__, checkConvergenceLearning and isMaximization. The default __call__ loops over computeAsScalar and ignores the design sample, as the U and EFF criteria do. Override __call__ for a criterion that needs the whole pool and the design, as the GMM criterion does. The default getInfillSample selects the minimizer or maximizer of the criterion values according to isMaximization; override it only to select a different infill sample, e.g. to add several points at once. The Gaussian process result set by the algorithm through setGaussianProcessRegression is available to the scoring code via getGaussianProcessRegression, e.g. through
GaussianProcessConditionalCovariance.Examples
>>> import openturns as ot >>> import openturns.experimental as otexp >>> class MyCriterion(otexp.PythonActiveLearningReliabilityFunction): ... def __init__(self): ... super().__init__(0.0, 2.0) ... def computeAsScalar(self, x): ... cov = ot.GaussianProcessConditionalCovariance(self.getGaussianProcessRegression()) ... m = cov.getConditionalMean(x)[0] ... s2 = cov.getConditionalMarginalVariance(x) ... return abs(m - self.getReliabilityThreshold()) / max(s2 ** 0.5, 1e-300) ... def checkConvergenceLearning(self, values): ... return values.getMin()[0] >= self.getLearningThreshold() ... def isMaximization(self): ... return False >>> criterion = otexp.ActiveLearningReliabilityFunction(MyCriterion())
- __init__(reliabilityThreshold, learningThreshold)¶
- checkConvergenceLearning(criterionValues)¶
Test convergence of active learning.
- computeAsScalar(x)¶
Pointwise score, looped over by the default __call__.
- getGaussianProcessRegression()¶
Gaussian process result accessor.
- getInfillSample(candidateSample, criterionValues)¶
Select the infill sample, defaults to the optimizer of the criterion values.
- getLearningThreshold()¶
Learning threshold accessor.
- getReliabilityThreshold()¶
Reliability threshold accessor.
- isMaximization()¶
Selection direction: True if the infill point maximizes the criterion.
- setGaussianProcessRegression(gprResult)¶
Gaussian process result accessor, set by the algorithm at each iteration.
- setLearningThreshold(learningThreshold)¶
Learning threshold accessor.
- setReliabilityThreshold(reliabilityThreshold)¶
Reliability threshold accessor.
Examples using the class¶
Custom active learning criterion for reliability analysis
OpenTURNS