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
7 changes: 3 additions & 4 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ jobs:
- name: Install dependencies
run: |
pip install sphinx sphinx_rtd_theme myst_parser
# WICHTIG: Wenn dein Code Abhängigkeiten hat (z.B. numpy, scipy),
# installiere sie hier, sonst kann 'autodoc' den Code nicht importieren!
# pip install -e .
# WICHTIG: autodoc importiert den Code, um die Docstrings zu lesen.
# Ohne diese Zeile schlaegt der Import fehl und die Seiten bleiben leer.
pip install -e .

- name: Sphinx build
run: |
cd docs
sphinx-apidoc -o ./source ../src -f
make html

- name: Deploy to GitHub Pages
Expand Down
26 changes: 8 additions & 18 deletions docs/source/Analysis.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
Analysis
=======================

.. py:function:: get_variances(a, lam = None, Dict = False)

This function returns the variances of the approximated ANOVA terms for all lam, if lam == None. Otherwise for the provided lam. Depending on Dict, it returns the approximated ANOVA terms as a vector or as a dict.

.. py:function:: get_GSI(a, lam = None, Dict = False)

This function returns the global sensitivity indices of the approximation for all lam, if lam == None. Otherwise for the provided lam. Depending on Dict, it returns the approximated ANOVA terms as a vector or as a dict.

.. py:function:: get_AttributeRanking(a, lam = None)

This function returns the attribute ranking of the approximation for all reg. parameters lam, if lam == None, as a dictionary of vectors of length ``a.d``. Otherwise for the provided lam as a vector of length ``a.d``.

.. py:function:: get_ShapleyValues(a, lam = None)

This function returns the Shapley values of the approximation for all reg. parameters lam, if lam == None, as a dictionary of vectors of length ``a.d``. Otherwise for the provided lam as a vector of length ``a.d``.
Analysis
========

.. automodule:: pyANOVAapprox.analysis
:members:
:undoc-members:
:show-inheritance:
:member-order: bysource
124 changes: 17 additions & 107 deletions docs/source/Approximation.rst
Original file line number Diff line number Diff line change
@@ -1,107 +1,17 @@
Approximation
=======================

.. py:class:: approx(X, y, U, N, basis="cos")

A class to hold the scattered data function approximation.

This class represents an approximation object constructed from scattered data nodes, function values, an ANOVA decomposition class, and a choice of basis functions. It supports multiple bases and regularization parameters.

.. rubric:: Attributes:

.. py:attribute:: basis

**Type:** `str`

Basis of the function space. Supported values are:

- `"per"`: exponential functions
- `"cos"`: cosine functions
- `"cheb"`: Chebyshev basis
- `"std"`: transformed exponential functions
- `"chui1"`: Haar wavelets
- `"chui2"`: Chui-Wang wavelets of order 2
- `"chui3"`: Chui-Wang wavelets of order 3
- `"chui4"`: Chui-Wang wavelets of order 4

.. py:attribute:: X

**Type:** `Numpy array wit dtype float`

The scattered data nodes with `M` rows and `d` columns.

.. py:attribute:: y

**Type:** `Numpy array wit dtype float or complex`

A vector of `M` function values. Complex-valued for `basis = "per"`, real-valued otherwise.

.. py:attribute:: U

**Type:** `List[Tuple[int]]`

A vector containing subsets of coordinate indices representing the ANOVA decomposition.

.. py:attribute:: N

**Type:** `List[int]`

Bandwidths for each ANOVA term.

.. py:attribute:: trafo

**Type:** `GroupedTransform`

Holds the grouped transformation.

.. py:attribute:: fc

**Type:** `Dict[float, GroupedCoefficients]`

holds the GroupedCoefficients after approximation for every different regularization parameters

.. rubric:: Constructor:

.. py:method:: approx(X, y, U, N, basis="cos")


.. rubric:: Additional Constructor:

.. py:method:: approx(X, y, ds, N, basis="cos")


.. rubric:: Functions:

.. py:method:: approximate(self, lam, max_iter=50, weights=None, verbose=False, solver=None, tol=1e-8)

If ``lam`` is a ``np.ndarray`` of dtype float, this function computes the approximation for the regularization parameters contained in ``lam``.

If ``lam`` is a float, this function computes the approximation for the regularization parameter ``lam``.

.. py:method:: evaluate(self, lam=None, X=None)

This function evaluates the approximation with optional node matrix ``X`` and regularization ``lam``.

- If both ``X`` and ``lam`` are given: evaluate at ``X`` for specific ``lam``.
- If only ``X`` is given: evaluate at ``X`` for all ``lam``.
- If only ``lam`` is given: evaluate at ``self.X`` for specific ``lam``.
- If neither are given: evaluate at ``self.X`` for all ``lam``.

.. py:method:: evaluateANOVAterms(self, X, lam=None)

This function evaluates the single ANOVA terms of the approximation on the nodes of matrix ``X`` and regularization ``lam``.

- If ``lam`` is given: evaluate at ``X`` for specific ``lam``.
- If ``lam`` is not given: evaluate at ``X`` for all ``lam``.

.. py:method:: evaluateSHAPterms(self, X, lam=None)

This function evaluates for each dimension the Shapley contribution to the overall approximation on the nodes of matrix ``X`` and regularization ``lam``.

- If ``lam`` is given: evaluate at ``X`` for specific ``lam``.
- If ``lam`` is not given: evaluate at ``X`` for all ``lam``.





Approximation
=============

.. automodule:: pyANOVAapprox.approx
:no-members:

.. autoclass:: pyANOVAapprox.approx.approx
:members:
:undoc-members:
:show-inheritance:
:member-order: bysource

.. autoclass:: pyANOVAapprox.approx.approx_setting
:members:
:undoc-members:
:show-inheritance:
:member-order: bysource
26 changes: 26 additions & 0 deletions docs/source/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* Custom overrides to widen the main content area for sphinx_rtd_theme */

/* Increase the maximum content width */
.wy-nav-content,
.rst-content {
max-width: 100vw;
height: 100vh;
}

/* Slightly reduce left padding for large screens so content uses more space */
@media (min-width: 1200px) {
.wy-nav-content {
padding-left: 20px;
padding-right: 20px;
}
}

/* Ensure the main document content uses more horizontal space */
.rst-content .section, .document {
margin-left: 0;
margin-right: 0;
}

.rubric {
font-size: 20px;
}
26 changes: 25 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,40 @@
"sphinx.ext.autodoc",
"sphinx.ext.napoleon", # Unterstützt Google/NumPy-Style Docstrings
"sphinx.ext.mathjax",
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
"myst_parser",
]

templates_path = ["_templates"]
templates_path = []
exclude_patterns = []

# -- autodoc -----------------------------------------------------------------
autodoc_default_options = {
"members": True,
"undoc-members": True,
"show-inheritance": True,
"member-order": "bysource",
}

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"scipy": ("https://docs.scipy.org/doc/scipy/", None),
}


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

# Auf das im Workflow genutzte Theme umgestellt
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
html_theme_options = {
"collapse_navigation": False,
"sticky_navigation": True,
"navigation_depth": 5,
}
html_css_files = [
"custom.css",
]
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ documentation for details.
:caption: Contents:

Analysis
modules
Approximation
Errors
Loading