Skip to content

Commit

Permalink
[doc][user-guide] Propagate abc/ ref link changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
SepandKashani committed Sep 15, 2023
1 parent 64d55a0 commit ff7b16b
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
20 changes: 10 additions & 10 deletions doc/guide/algebra.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@
"\n",
"Every time you perform an arithmetic operation, Pyxu automatically infers the output type based on the properties of the operators involved in the operation. This type inference is super convenient because it saves you from manual calculations! \n",
"\n",
"For example, Pyxu takes care of updating as needed methods like `apply()`[🔗](../api/abc/operator.html#pyxu.abc.Map.apply), `jacobian()`[🔗](../api/abc/operator.html#pyxu.abc.DiffMap.jacobian), `grad()`[🔗](../api/abc/operator.html#pyxu.abc.DiffFunc.grad), `prox()`[🔗](../api/abc/operator.html#pyxu.abc.ProxFunc.prox), and `adjoint()`[🔗](../api/abc/operator.html#pyxu.abc.LinOp.adjoint) according to arithmetic rules. This means you can plug these composite operators directly into proximal gradient algorithms without sweating the details of implementing gradients or proximal steps.\n",
"For example, Pyxu takes care of updating as needed methods like `apply()`[🔗](../api/abc.html#pyxu.abc.Map.apply), `jacobian()`[🔗](../api/abc.html#pyxu.abc.DiffMap.jacobian), `grad()`[🔗](../api/abc.html#pyxu.abc.DiffFunc.grad), `prox()`[🔗](../api/abc.html#pyxu.abc.ProxFunc.prox), and `adjoint()`[🔗](../api/abc.html#pyxu.abc.LinOp.adjoint) according to arithmetic rules. This means you can plug these composite operators directly into proximal gradient algorithms without sweating the details of implementing gradients or proximal steps.\n",
"\n",
"## Behind the Scenes: Arithmetic Rules\n",
"\n",
"For those who love to peek under the hood, Pyxu utilizes a set of arithmetic rules located in the `pyxu.abc.arithmetic`[🔗](../api/abc/arithmetic.html) module:\n",
"\n",
"- `Rule`[🔗](../api/abc/arithmetic.html#pyxu.abc.arithmetic.Rule): The base class for all arithmetic rules.\n",
"- `ScaleRule`[🔗](../api/abc/arithmetic.html#pyxu.abc.arithmetic.ScaleRule): Handles scaling of operators by scalars.\n",
"- `ArgScaleRule`[🔗](../api/abc/arithmetic.html#pyxu.abc.arithmetic.ArgScaleRule): Manages the dilation of the arguments of operators.\n",
"- `ArgShiftRule`[🔗](../api/abc/arithmetic.html#pyxu.abc.arithmetic.ArgShiftRule): Takes care of shifting the arguments of operators.\n",
"- `AddRule`[🔗](../api/abc/arithmetic.html#pyxu.abc.arithmetic.AddRule): Manages the addition of two operators.\n",
"- `ChainRule`[🔗](../api/abc/arithmetic.html#pyxu.abc.arithmetic.ChainRule): Deals with the composition of two operators.\n",
"- `PowerRule`[🔗](../api/abc/arithmetic.html#pyxu.abc.arithmetic.PowerRule): Handles exponentiation of an operator.\n",
"- `TransposeRule`[🔗](../api/abc/arithmetic.html#pyxu.abc.arithmetic.TransposeRule): Takes care of transposing a linear operator.\n",
"- `Rule`[🔗](../api/abc.html#pyxu.abc.arithmetic.Rule): The base class for all arithmetic rules.\n",
"- `ScaleRule`[🔗](../api/abc.html#pyxu.abc.arithmetic.ScaleRule): Handles scaling of operators by scalars.\n",
"- `ArgScaleRule`[🔗](../api/abc.html#pyxu.abc.arithmetic.ArgScaleRule): Manages the dilation of the arguments of operators.\n",
"- `ArgShiftRule`[🔗](../api/abc.html#pyxu.abc.arithmetic.ArgShiftRule): Takes care of shifting the arguments of operators.\n",
"- `AddRule`[🔗](../api/abc.html#pyxu.abc.arithmetic.AddRule): Manages the addition of two operators.\n",
"- `ChainRule`[🔗](../api/abc.html#pyxu.abc.arithmetic.ChainRule): Deals with the composition of two operators.\n",
"- `PowerRule`[🔗](../api/abc.html#pyxu.abc.arithmetic.PowerRule): Handles exponentiation of an operator.\n",
"- `TransposeRule`[🔗](../api/abc.html#pyxu.abc.arithmetic.TransposeRule): Takes care of transposing a linear operator.\n",
"\n",
"### Working Example 🎯\n",
"\n",
"Consider the composition of a `DiffFunc`[🔗](../api/abc/operator.html#pyxu.abc.DiffFunc) with a `DiffMap`[🔗](../api/abc/operator.html#pyxu.abc.DiffMap). Let `f` be a `DiffFunc` and `L` be a `DiffMap`. Then their composition `h` is another `DiffFunc`, and the gradient is given by:\n",
"Consider the composition of a `DiffFunc`[🔗](../api/abc.html#pyxu.abc.DiffFunc) with a `DiffMap`[🔗](../api/abc.html#pyxu.abc.DiffMap). Let `f` be a `DiffFunc` and `L` be a `DiffMap`. Then their composition `h` is another `DiffFunc`, and the gradient is given by:\n",
"\n",
"```python\n",
">> h = f * L\n",
Expand Down
4 changes: 2 additions & 2 deletions doc/guide/algorithms.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@
"\n",
"## Implementing New Algorithms \n",
"\n",
"To implement a new iterative solver, users need to sub-class `pyxu.abc.solver.Solver`[🔗](../api/abc/solver.html) and overwrite some of its core methods, such as `m_init()`[🔗](../api/abc/solver.html#pyxu.abc.Solver.m_init), and `m_step()`[🔗](../api/abc/solver.html#pyxu.abc.Solver.m_step), which describe the initalization and update step of iterative algorithms (see the API Reference for more details). \n",
"To implement a new iterative solver, users need to sub-class `pyxu.abc.solver.Solver`[🔗](../api/abc.html#pyxu.abc.Solver) and overwrite some of its core methods, such as `m_init()`[🔗](../api/abc.html#pyxu.abc.Solver.m_init), and `m_step()`[🔗](../api/abc.html#pyxu.abc.Solver.m_step), which describe the initalization and update step of iterative algorithms (see the API Reference for more details). \n",
"\n",
"\n",
"Sub-classes of `Solver` inherit automatically from its very versatile API for solving optimisation problems, with the following notable features:\n",
"\n",
" * manual/automatic/background execution of solver iterations via parameters provided to `fit()`[🔗](../api/abc/solver.html#pyxu.abc.Solver.fit). \n",
" * manual/automatic/background execution of solver iterations via parameters provided to `fit()`[🔗](../api/abc.html#pyxu.abc.Solver.fit). \n",
" * automatic checkpointing of solver progress, providing a safe restore point in case of faulty numerical code. Each solver instance backs its state and final output to a folder on disk for post-analysis. In particular `fit()` will never crash: detailed exception information will always be available in a logfile for post-analysis.\n",
" * solve for multiple initial points in parallel.\n",
"\n",
Expand Down
12 changes: 6 additions & 6 deletions doc/guide/funcs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
"> \n",
"> 1. **Subclassing**: Extend these classes to create customized functionals tailored to your problem. \n",
"> \n",
"> 2. **Generic Constructor Routine**: Utilize the `from_source`[🔗](../api/operator.interop.html#general) method to define new functionals from their core methods, like `apply()`[🔗](../api/abc/operator.html#pyxu.abc.Map.apply), `grad()`[🔗](../api/abc/operator.html#pyxu.abc.DiffFunc.grad), or `prox()`[🔗](../api/abc/operator.html#pyxu.abc.ProxFunc.prox).\n",
"> 2. **Generic Constructor Routine**: Utilize the `from_source`[🔗](../api/operator.interop.html#general) method to define new functionals from their core methods, like `apply()`[🔗](../api/abc.html#pyxu.abc.Map.apply), `grad()`[🔗](../api/abc.html#pyxu.abc.DiffFunc.grad), or `prox()`[🔗](../api/abc.html#pyxu.abc.ProxFunc.prox).\n",
">\n",
"> Additionally, don't forget to explore our comprehensive Reference API. It features pre-implemented versions of many commonly used functionals, serving as both a shortcut for common tasks and a useful learning resource.\n",
"\n",
"### `Func`: The Foundation Stone 🧱\n",
"The `Func`[🔗](../api/abc/operator.html#pyxu.abc.Func) class is the base class in the functional hierarchy. Its core method is `apply()`, which computes the value of the functional at a given input.\n",
"The `Func`[🔗](../api/abc.html#pyxu.abc.Func) class is the base class in the functional hierarchy. Its core method is `apply()`, which computes the value of the functional at a given input.\n",
"\n",
"Here's a simplified example, implementing the squared $L_2$ norm:\n",
"\n",
Expand All @@ -53,7 +53,7 @@
"\n",
"### `DiffFunc`: Differentiable Functionals 🎯\n",
"\n",
"The `DiffFunc`[🔗](../api/abc/operator.html#pyxu.abc.DiffFunc) class extends `Func` for functionals that have a well-defined gradient. It introduces an additional method, `grad()`, for gradient computation.\n",
"The `DiffFunc`[🔗](../api/abc.html#pyxu.abc.DiffFunc) class extends `Func` for functionals that have a well-defined gradient. It introduces an additional method, `grad()`, for gradient computation.\n",
"\n",
"```python\n",
"from pyxu.abc import DiffFunc\n",
Expand All @@ -70,7 +70,7 @@
"\n",
"### `ProxFunc`: Proximable Functionals 🛡️\n",
"\n",
"For functionals with a simple proximal operator, you'll find `ProxFunc`[🔗](../api/abc/operator.html#pyxu.abc.ProxFunc) extremely useful. It offers the `prox()` method, which evaluates the proximal operator of the functional. Here's an example using the $L_1$ norm:\n",
"For functionals with a simple proximal operator, you'll find `ProxFunc`[🔗](../api/abc.html#pyxu.abc.ProxFunc) extremely useful. It offers the `prox()` method, which evaluates the proximal operator of the functional. Here's an example using the $L_1$ norm:\n",
"\n",
"```python\n",
"from pyxu.abc import ProxFunc\n",
Expand All @@ -85,7 +85,7 @@
"\n",
"#### Moreau Envelope for Smoothing\n",
"\n",
"You can also smooth out a proximable functional using the `moreau_envelope()`[🔗](../api/abc/operator.html#pyxu.abc.ProxFunc.moreau_envelope) method. For example, you can smooth the L1 norm to create the [Huber loss function](https://www.wikiwand.com/en/Huber_loss) as follows:\n",
"You can also smooth out a proximable functional using the `moreau_envelope()`[🔗](../api/abc.html#pyxu.abc.ProxFunc.moreau_envelope) method. For example, you can smooth the L1 norm to create the [Huber loss function](https://www.wikiwand.com/en/Huber_loss) as follows:\n",
"\n",
"```python\n",
"huber = L1Norm(dim).moreau_envelope(mu=0.1)\n",
Expand All @@ -109,7 +109,7 @@
"\n",
"### Specialized Classes: `ProxDiffFunc`, `LinFunc`, `QuadraticFunc` 🎨\n",
"\n",
"These classes are for functionals that offer even more, like being both proximable and differentiable (`ProxDiffFunc`[🔗](../api/abc/operator.html#pyxu.abc.ProxDiffFunc)), or being linear (`LinFunc`[🔗](../api/abc/operator.html#pyxu.abc.LinFunc)) or quadratic (`QuadraticFunc`[🔗](../api/abc/operator.html#pyxu.abc.QuadraticFunc)). Quadratic functionals are especially important in primal-dual methods for faster convergence, so do use them when you can! \n",
"These classes are for functionals that offer even more, like being both proximable and differentiable (`ProxDiffFunc`[🔗](../api/abc.html#pyxu.abc.ProxDiffFunc)), or being linear (`LinFunc`[🔗](../api/abc.html#pyxu.abc.LinFunc)) or quadratic (`QuadraticFunc`[🔗](../api/abc.html#pyxu.abc.QuadraticFunc)). Quadratic functionals are especially important in primal-dual methods for faster convergence, so do use them when you can! \n",
"\n",
"> Note: when dealing with `ProxDiffFunc` instances, it can be hard to decide whether the gradient or proximal operator should be used for optimization purposes. The general rule-of-thumb is to use the gradient as much as possible, as the latter requires more regularity on the objective functional, which can be leveraged by solvers for fatser convergence. \n",
"\n",
Expand Down
Loading

0 comments on commit ff7b16b

Please sign in to comment.