Skip to content

Commit

Permalink
GitHub Actions build openturns/otsvm 6735919320
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions committed Nov 2, 2023
1 parent 360330b commit f4e4fe8
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 28 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"outputs": [],
"source": [
"import openturns as ot\nimport otsvm\n\n# create a function, here we create the Sobol function\ndimension = 3\nmeanTh = 1.0\na = ot.Point(dimension)\ninputVariables = ot.Description(dimension)\nformula = \"1.0\"\ncovTh = 1.0\nfor i in range(dimension):\n a[i] = 0.5 * i\n covTh = covTh * (1.0 + 1.0 / (3.0 * (1.0 + a[i]) ** 2))\n inputVariables[i] = \"xi\" + str(i)\n formula += (\n \" * ((abs(4.0 * xi\"\n + str(i)\n + \" -2.0) + \"\n + str(a[i])\n + \") / (1.0 + \"\n + str(a[i])\n + \"))\"\n )\ncovTh = covTh - 1.0\nmodel = ot.SymbolicFunction(inputVariables, ot.Description(1, formula))\n\n# create the input distribution\not.RandomGenerator.SetSeed(0)\nmarginals = ot.DistributionCollection(dimension)\nfor i in range(dimension):\n marginals[i] = ot.Uniform(0.0, 1.0)\ndistribution = ot.ComposedDistribution(marginals)\n\n# create lists of kernel parameters and tradeoff factors\ntradeoff = [0.01, 0.1, 1, 10, 100, 1000]\nkernel = [0.001, 0.01, 0.1, 1, 10, 100]\n\n# first example : create the problem with an input and output samples:\n# first, we create samples\ndataIn = distribution.getSample(250)\ndataOut = model(dataIn)\n# second, we create our svm regression object, we must select the third parameter\n# in an enumerate in the list { NormalRBF, Linear, Sigmoid, Polynomial }\nalgo = otsvm.LibSVMRegression(dataIn, dataOut, otsvm.LibSVM.NormalRbf)\n# third, we set kernel parameter and tradeoff factor\nalgo.setTradeoffFactor(tradeoff)\nalgo.setKernelParameter(kernel)\n# Perform the algorithm\nalgo.run()\n# Stream out the results\nresult = algo.getResult()\n# get the residual error\nresidual = result.getResiduals()\n# get the relative error\nrelativeError = result.getRelativeErrors()\nprint(f\"residual={residual} error={relativeError}\")\n\n# second example : create the problem with an experiment plane:\n# first, we create the plane\nmyExperiment = ot.MonteCarloExperiment(distribution, 250)\ndataIn = myExperiment.generate()\ndataOut = model(dataIn)\n# second, we create our svm regression object, the first parameter is the\n# function\nalgo2 = otsvm.LibSVMRegression(dataIn, dataOut, otsvm.LibSVM.Linear)\n# third, we set kernel parameter and tradeoff factor\nalgo2.setTradeoffFactor(tradeoff)\nalgo2.setKernelParameter(kernel)\n# Perform the algorithm\nalgo2.run()\n# Stream out the results\nresult = algo2.getResult()\n# get the residual error\nresidual = result.getResiduals()\n# get the relative error\nrelativeError = result.getRelativeErrors()\nprint(f\"residual={residual} error={relativeError}\")\n\n# third example is here to present you the SVMResourceMap class.\n# Users can fix others parameters like the degree and the constant of the\n# Polynomial Kernel,the cacheSize, the number of folds or the epsilon\n# first, we create samples\ndataIn = distribution.getSample(250)\ndataOut = model(dataIn)\n# second, we create our svm regression object\n# here, we select the Polynomial Kernel but by default his degree is 3. We want a\n# degree of 2\not.ResourceMap.Set(\"LibSVM-DegreePolynomialKernel\", \"2\")\n# now the degree of the Polynomial kernel is 2\nalgo = otsvm.LibSVMRegression(dataIn, dataOut, otsvm.LibSVM.Polynomial)\n# third, we set kernel parameter and tradeoff factor\nalgo.setTradeoffFactor(tradeoff)\nalgo.setKernelParameter(kernel)\n# Perform the algorithm\n#algo.run()\n## Stream out the results\n#result = algo.getResult()\n#print(result)\n## get the residual error\n#residual = result.getResiduals()\n## get the relative error\n#relativeError = result.getRelativeErrors()"
"import openturns as ot\nimport otsvm\n\n# create a function, here we create the Sobol function\ndimension = 3\nmeanTh = 1.0\na = ot.Point(dimension)\ninputVariables = ot.Description(dimension)\nformula = \"1.0\"\ncovTh = 1.0\nfor i in range(dimension):\n a[i] = 0.5 * i\n covTh = covTh * (1.0 + 1.0 / (3.0 * (1.0 + a[i]) ** 2))\n inputVariables[i] = \"xi\" + str(i)\n formula += (\n \" * ((abs(4.0 * xi\"\n + str(i)\n + \" -2.0) + \"\n + str(a[i])\n + \") / (1.0 + \"\n + str(a[i])\n + \"))\"\n )\ncovTh = covTh - 1.0\nmodel = ot.SymbolicFunction(inputVariables, ot.Description(1, formula))\n\n# create the input distribution\not.RandomGenerator.SetSeed(0)\nmarginals = ot.DistributionCollection(dimension)\nfor i in range(dimension):\n marginals[i] = ot.Uniform(0.0, 1.0)\ndistribution = ot.ComposedDistribution(marginals)\n\n# create lists of kernel parameters and tradeoff factors\ntradeoff = [0.01, 0.1, 1, 10, 100, 1000]\nkernel = [0.001, 0.01, 0.1, 1, 10, 100]\n\n# first example : create the problem with an input and output samples:\n# first, we create samples\ndataIn = distribution.getSample(250)\ndataOut = model(dataIn)\n# second, we create our svm regression object, we must select the third parameter\n# in an enumerate in the list { NormalRBF, Linear, Sigmoid, Polynomial }\nalgo = otsvm.LibSVMRegression(dataIn, dataOut, otsvm.LibSVM.NormalRbf)\n# third, we set kernel parameter and tradeoff factor\nalgo.setTradeoffFactor(tradeoff)\nalgo.setKernelParameter(kernel)\n# Perform the algorithm\nalgo.run()\n# Stream out the results\nresult = algo.getResult()\n# get the residual error\nresidual = result.getResiduals()\n# get the relative error\nrelativeError = result.getRelativeErrors()\nprint(f\"residual={residual} error={relativeError}\")\n\n# second example : create the problem with an experiment plane:\n# first, we create the plane\nmyExperiment = ot.MonteCarloExperiment(distribution, 250)\ndataIn = myExperiment.generate()\ndataOut = model(dataIn)\n# second, we create our svm regression object, the first parameter is the\n# function\nalgo2 = otsvm.LibSVMRegression(dataIn, dataOut, otsvm.LibSVM.Linear)\n# third, we set kernel parameter and tradeoff factor\nalgo2.setTradeoffFactor(tradeoff)\nalgo2.setKernelParameter(kernel)\n# Perform the algorithm\nalgo2.run()\n# Stream out the results\nresult = algo2.getResult()\n# get the residual error\nresidual = result.getResiduals()\n# get the relative error\nrelativeError = result.getRelativeErrors()\nprint(f\"residual={residual} error={relativeError}\")\n\n# third example is here to present you the SVMResourceMap class.\n# Users can fix others parameters like the degree and the constant of the\n# Polynomial Kernel,the cacheSize, the number of folds or the epsilon\n# first, we create samples\ndataIn = distribution.getSample(250)\ndataOut = model(dataIn)\n# second, we create our svm regression object\n# here, we select the Polynomial Kernel but by default his degree is 3. We want a\n# degree of 2\not.ResourceMap.Set(\"LibSVM-DegreePolynomialKernel\", \"2\")\n# now the degree of the Polynomial kernel is 2\nalgo = otsvm.LibSVMRegression(dataIn, dataOut, otsvm.LibSVM.Polynomial)\n# third, we set kernel parameter and tradeoff factor\nalgo.setTradeoffFactor(tradeoff)\nalgo.setKernelParameter(kernel)\n# Perform the algorithm\n# algo.run()\n## Stream out the results\n# result = algo.getResult()\n# print(result)\n## get the residual error\n# residual = result.getResiduals()\n## get the relative error\n# relativeError = result.getRelativeErrors()"
]
}
],
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# %%
# The objective of this Use Case is to create a SVM Classification algorithm in order to build a metamodel that separates data in 2 classes.
#
#
# otsvm enables to:
#
# - set lists of tradeoff factors and kernel parameter with the methods setTradeoffFactor, setKernelParameter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@
algo.setTradeoffFactor(tradeoff)
algo.setKernelParameter(kernel)
# Perform the algorithm
#algo.run()
# algo.run()
## Stream out the results
#result = algo.getResult()
#print(result)
# result = algo.getResult()
# print(result)
## get the residual error
#residual = result.getResiduals()
# residual = result.getResiduals()
## get the relative error
#relativeError = result.getRelativeErrors()
# relativeError = result.getRelativeErrors()
12 changes: 6 additions & 6 deletions otsvm/master/_sources/auto_examples/plot_example1.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ Usually, the algorithm always converges, but this can take a long while, mostly
algo.setTradeoffFactor(tradeoff)
algo.setKernelParameter(kernel)
# Perform the algorithm
#algo.run()
# algo.run()
## Stream out the results
#result = algo.getResult()
#print(result)
# result = algo.getResult()
# print(result)
## get the residual error
#residual = result.getResiduals()
# residual = result.getResiduals()
## get the relative error
#relativeError = result.getRelativeErrors()
# relativeError = result.getRelativeErrors()
Expand All @@ -162,7 +162,7 @@ Usually, the algorithm always converges, but this can take a long while, mostly
.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 4.452 seconds)
**Total running time of the script:** (0 minutes 6.811 seconds)


.. _sphx_glr_download_auto_examples_plot_example1.py:
Expand Down
2 changes: 1 addition & 1 deletion otsvm/master/_sources/auto_examples/plot_example2.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ otsvm enables to:
.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 1.962 seconds)
**Total running time of the script:** (0 minutes 2.432 seconds)


.. _sphx_glr_download_auto_examples_plot_example2.py:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

Computation times
=================
**00:06.414** total execution time for **auto_examples** files:
**00:09.242** total execution time for **auto_examples** files:

+-----------------------------------------------------------------------+-----------+--------+
| :ref:`sphx_glr_auto_examples_plot_example1.py` (``plot_example1.py``) | 00:04.452 | 0.0 MB |
| :ref:`sphx_glr_auto_examples_plot_example1.py` (``plot_example1.py``) | 00:06.811 | 0.0 MB |
+-----------------------------------------------------------------------+-----------+--------+
| :ref:`sphx_glr_auto_examples_plot_example2.py` (``plot_example2.py``) | 00:01.962 | 0.0 MB |
| :ref:`sphx_glr_auto_examples_plot_example2.py` (``plot_example2.py``) | 00:02.432 | 0.0 MB |
+-----------------------------------------------------------------------+-----------+--------+
12 changes: 6 additions & 6 deletions otsvm/master/auto_examples/plot_example1.html
Original file line number Diff line number Diff line change
Expand Up @@ -162,21 +162,21 @@ <h3>Navigation</h3>
<span class="n">algo</span><span class="o">.</span><span class="n">setTradeoffFactor</span><span class="p">(</span><span class="n">tradeoff</span><span class="p">)</span>
<span class="n">algo</span><span class="o">.</span><span class="n">setKernelParameter</span><span class="p">(</span><span class="n">kernel</span><span class="p">)</span>
<span class="c1"># Perform the algorithm</span>
<span class="c1">#algo.run()</span>
<span class="c1"># algo.run()</span>
<span class="c1">## Stream out the results</span>
<span class="c1">#result = algo.getResult()</span>
<span class="c1">#print(result)</span>
<span class="c1"># result = algo.getResult()</span>
<span class="c1"># print(result)</span>
<span class="c1">## get the residual error</span>
<span class="c1">#residual = result.getResiduals()</span>
<span class="c1"># residual = result.getResiduals()</span>
<span class="c1">## get the relative error</span>
<span class="c1">#relativeError = result.getRelativeErrors()</span>
<span class="c1"># relativeError = result.getRelativeErrors()</span>
</pre></div>
</div>
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>residual=[0.0043475] error=[0.00793795]
residual=[0.0515409] error=[1.04162]
</pre></div>
</div>
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> (0 minutes 4.452 seconds)</p>
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> (0 minutes 6.811 seconds)</p>
<div class="sphx-glr-footer sphx-glr-footer-example docutils container" id="sphx-glr-download-auto-examples-plot-example1-py">
<div class="sphx-glr-download sphx-glr-download-python docutils container">
<p><a class="reference download internal" download="" href="../_downloads/ce615eeeaf183d728a05b647cb915a04/plot_example1.py"><code class="xref download docutils literal notranslate"><span class="pre">Download</span> <span class="pre">Python</span> <span class="pre">source</span> <span class="pre">code:</span> <span class="pre">plot_example1.py</span></code></a></p>
Expand Down
2 changes: 1 addition & 1 deletion otsvm/master/auto_examples/plot_example2.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ <h3>Navigation</h3>
Accuracy(p.c.)= 100.0
</pre></div>
</div>
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> (0 minutes 1.962 seconds)</p>
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> (0 minutes 2.432 seconds)</p>
<div class="sphx-glr-footer sphx-glr-footer-example docutils container" id="sphx-glr-download-auto-examples-plot-example2-py">
<div class="sphx-glr-download sphx-glr-download-python docutils container">
<p><a class="reference download internal" download="" href="../_downloads/a8b175cd29751dc0229ceb76947711bf/plot_example2.py"><code class="xref download docutils literal notranslate"><span class="pre">Download</span> <span class="pre">Python</span> <span class="pre">source</span> <span class="pre">code:</span> <span class="pre">plot_example2.py</span></code></a></p>
Expand Down
6 changes: 3 additions & 3 deletions otsvm/master/auto_examples/sg_execution_times.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ <h3>Navigation</h3>

<section id="computation-times">
<span id="sphx-glr-auto-examples-sg-execution-times"></span><h1>Computation times<a class="headerlink" href="#computation-times" title="Link to this heading"></a></h1>
<p><strong>00:06.414</strong> total execution time for <strong>auto_examples</strong> files:</p>
<p><strong>00:09.242</strong> total execution time for <strong>auto_examples</strong> files:</p>
<table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="plot_example1.html#sphx-glr-auto-examples-plot-example1-py"><span class="std std-ref">Regression</span></a> (<code class="docutils literal notranslate"><span class="pre">plot_example1.py</span></code>)</p></td>
<td><p>00:04.452</p></td>
<td><p>00:06.811</p></td>
<td><p>0.0 MB</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="plot_example2.html#sphx-glr-auto-examples-plot-example2-py"><span class="std std-ref">Classification</span></a> (<code class="docutils literal notranslate"><span class="pre">plot_example2.py</span></code>)</p></td>
<td><p>00:01.962</p></td>
<td><p>00:02.432</p></td>
<td><p>0.0 MB</p></td>
</tr>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion otsvm/master/searchindex.js

Large diffs are not rendered by default.

0 comments on commit f4e4fe8

Please sign in to comment.