Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions examples/RequestedBBRCProblem.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# RequestedBBRCProblem class use case\n",
"\n",
"This example presents a simple use of the RequestedBBRCProblem class."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import openturns as ot\n",
"import otbenchmark as otb"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "RP8\n"
}
],
"source": [
"problem = otb.RequestedBBRCProblem(\"testuser\", \"testpass\", -1, 1)\n",
"print(problem.name)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"event = problem.getEvent()\n",
"g = event.getFunction()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": "0.0007888456943755395"
},
"metadata": {},
"execution_count": 4
}
],
"source": [
"problem.getProbability()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# Create the Monte-Carlo algorithm\n",
"algoProb = ot.ProbabilitySimulationAlgorithm(event)\n",
"# MaximumOuterSampling set to a very low value to make a fast example.\n",
"# More realistic parameter value (e.g. 1000).\n",
"algoProb.setMaximumOuterSampling(10)\n",
"algoProb.setMaximumCoefficientOfVariation(0.01)\n",
"algoProb.run()"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please insert a comment that explains that your intent in selecting a low value of the maximumOuterSampling : it is chosen to make a fast example, but a more realistic parameter value (e.g. 1000) should be chosen in practice. This will clarify your motivations in the example. Please insert the code to print the estimated probability, because it is the concrete goal of the example but add a comment that explains that, because of the low value of the maximumOuterSampling, the estimate is not very accurate.

]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": "Number of function calls = 10\nFailure Probability = 0.0000\n"
}
],
"source": [
"# Get the results\n",
"resultAlgo = algoProb.getResult()\n",
"neval = g.getEvaluationCallsNumber()\n",
"print(\"Number of function calls = %d\" % (neval))\n",
"# Because of the low value of the maximumOuterSampling, the estimate is not very accurate.\n",
"pf = resultAlgo.getProbabilityEstimate()\n",
"print(\"Failure Probability = %.4f\" % (pf))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3-final"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
30 changes: 30 additions & 0 deletions examples/distributions/beta_results.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
set_id,problem_id,reliability_problem_id,beta
-1,1,8,3.16
-1,2,22,2.64
1,1,14,2.42
1,2,24,2.76
1,3,28,5.11
1,4,31,3.58
1,5,38,2.48
1,6,53,1.86
1,7,54,3.09
1,8,63,3.36
1,9,75,2.33
1,10,107,5.0
1,11,111,4.81
1,12,201,3.7
1,13,203,4.92
1,14,213,3.45
1,15,300,3.88
1,16,301,3.81
2,1,25,4.36
2,2,33,2.80
2,3,35,2.70
2,4,55,-0.15
2,5,57,1.91
2,6,60,1.70
2,7,77,5.0
2,8,89,2.55
2,9,91,3.19
2,10,110,4.0
2,11,202,3.43
Loading