Compare e2a46b0 ... +1 ... c9957f3

Coverage Reach
randprocs/markov/continuous/_linear_sde.py randprocs/markov/continuous/_diffusions.py randprocs/markov/continuous/_lti_sde.py randprocs/markov/continuous/_sde.py randprocs/markov/continuous/__init__.py randprocs/markov/continuous/_mfd.py randprocs/markov/integrator/_iwp.py randprocs/markov/integrator/_matern.py randprocs/markov/integrator/_ioup.py randprocs/markov/integrator/_integrator.py randprocs/markov/integrator/_preconditioner.py randprocs/markov/integrator/__init__.py randprocs/markov/integrator/convert/_convert.py randprocs/markov/integrator/convert/__init__.py randprocs/markov/discrete/_linear_gaussian.py randprocs/markov/discrete/_nonlinear_gaussian.py randprocs/markov/discrete/_lti_gaussian.py randprocs/markov/discrete/_condition_state.py randprocs/markov/discrete/__init__.py randprocs/markov/_transition.py randprocs/markov/_markov.py randprocs/markov/utils/_generate_measurements.py randprocs/markov/utils/__init__.py randprocs/markov/__init__.py randprocs/kernels/_kernel.py randprocs/kernels/_arithmetic_fallbacks.py randprocs/kernels/_product_matern.py randprocs/kernels/_matern.py randprocs/kernels/__init__.py randprocs/kernels/_white_noise.py randprocs/kernels/_rational_quadratic.py randprocs/kernels/_exponentiated_quadratic.py randprocs/kernels/_linear.py randprocs/kernels/_polynomial.py randprocs/kernels/_arithmetic.py randprocs/_random_process.py randprocs/_gaussian_process.py randprocs/__init__.py linops/_linear_operator.py linops/_kronecker.py linops/_arithmetic.py linops/_scaling.py linops/_arithmetic_fallbacks.py linops/__init__.py linops/_utils.py randvars/_random_variable.py randvars/_normal.py randvars/_arithmetic.py randvars/_scipy_stats.py randvars/_randomvariablelist.py randvars/_constant.py randvars/_categorical.py randvars/__init__.py randvars/_utils.py diffeq/odefilter/init_routines/_autodiff.py diffeq/odefilter/init_routines/_non_probabilistic_fit.py diffeq/odefilter/init_routines/_stack.py diffeq/odefilter/init_routines/_interface.py diffeq/odefilter/init_routines/__init__.py diffeq/odefilter/information_operators/_ode_residual.py diffeq/odefilter/information_operators/_information_operator.py diffeq/odefilter/information_operators/_approx_information_operator.py diffeq/odefilter/information_operators/__init__.py diffeq/odefilter/_odefilter.py diffeq/odefilter/utils/_problem_utils.py diffeq/odefilter/utils/__init__.py diffeq/odefilter/approx_strategies/_ek.py diffeq/odefilter/approx_strategies/__init__.py diffeq/odefilter/approx_strategies/_approx_strategy.py diffeq/odefilter/_odefilter_solution.py diffeq/odefilter/__init__.py diffeq/perturbed/step/_perturbedstepsolver.py diffeq/perturbed/step/_perturbedstepsolution.py diffeq/perturbed/step/_perturbation_functions.py diffeq/perturbed/step/__init__.py diffeq/perturbed/scipy_wrapper/_wrapped_scipy_solver.py diffeq/perturbed/scipy_wrapper/_wrapped_scipy_odesolution.py diffeq/perturbed/scipy_wrapper/__init__.py diffeq/perturbed/__init__.py diffeq/_odesolver.py diffeq/stepsize/_steprule.py diffeq/stepsize/__init__.py diffeq/stepsize/_propose_firststep.py diffeq/_perturbsolve_ivp.py diffeq/callbacks/_discrete_callback.py diffeq/callbacks/_callback.py diffeq/callbacks/__init__.py diffeq/_probsolve_ivp.py diffeq/_odesolution.py diffeq/_odesolver_state.py diffeq/_utils.py diffeq/__init__.py linalg/solvers/matrixbased.py linalg/solvers/belief_updates/matrix_based/_matrix_based_linear_belief_update.py linalg/solvers/belief_updates/matrix_based/_symmetric_matrix_based_linear_belief_update.py linalg/solvers/belief_updates/matrix_based/__init__.py linalg/solvers/belief_updates/solution_based/_projected_residual_belief_update.py linalg/solvers/belief_updates/solution_based/__init__.py linalg/solvers/belief_updates/_linear_solver_belief_update.py linalg/solvers/belief_updates/__init__.py linalg/solvers/policies/_conjugate_gradient.py linalg/solvers/policies/_random_unit_vector.py linalg/solvers/policies/_linear_solver_policy.py linalg/solvers/policies/__init__.py linalg/solvers/beliefs/_linear_system_belief.py linalg/solvers/beliefs/__init__.py linalg/solvers/_state.py linalg/solvers/stopping_criteria/_posterior_contraction.py linalg/solvers/stopping_criteria/_residual_norm.py linalg/solvers/stopping_criteria/_maxiter.py linalg/solvers/stopping_criteria/__init__.py linalg/solvers/stopping_criteria/_linear_solver_stopping_criterion.py linalg/solvers/_probabilistic_linear_solver.py linalg/solvers/information_ops/__init__.py linalg/solvers/information_ops/_linear_solver_information_op.py linalg/solvers/information_ops/_matvec.py linalg/solvers/information_ops/_projected_residual.py linalg/solvers/__init__.py linalg/_problinsolve.py linalg/__init__.py linalg/_bayescg.py filtsmooth/gaussian/approx/_unscentedkalman.py filtsmooth/gaussian/approx/_extendedkalman.py filtsmooth/gaussian/approx/_interface.py filtsmooth/gaussian/approx/__init__.py filtsmooth/gaussian/_kalmanposterior.py filtsmooth/gaussian/_kalman.py filtsmooth/gaussian/__init__.py filtsmooth/particle/_particle_filter.py filtsmooth/particle/_importance_distributions.py filtsmooth/particle/_particle_filter_posterior.py filtsmooth/particle/__init__.py filtsmooth/optim/_iterated_component.py filtsmooth/optim/_stopping_criterion.py filtsmooth/optim/_state_space_optimizer.py filtsmooth/optim/_gauss_newton.py filtsmooth/optim/__init__.py filtsmooth/_timeseriesposterior.py filtsmooth/utils/_merge_regression_problems.py filtsmooth/utils/__init__.py filtsmooth/_kalman_filter_smoother.py filtsmooth/__init__.py filtsmooth/_bayesfiltsmooth.py problems/zoo/diffeq/_ivp_examples.py problems/zoo/diffeq/_ivp_examples_jax.py problems/zoo/diffeq/__init__.py problems/zoo/linalg/_suitesparse_matrix.py problems/zoo/linalg/_random_spd_matrix.py problems/zoo/linalg/_random_linear_system.py problems/zoo/linalg/__init__.py problems/zoo/filtsmooth/_filtsmooth_problems.py problems/zoo/filtsmooth/__init__.py problems/_problems.py problems/__init__.py quad/solvers/bayesian_quadrature.py quad/solvers/stopping_criteria/__init__.py quad/solvers/stopping_criteria/_rel_mean_change.py quad/solvers/stopping_criteria/_max_nevals.py quad/solvers/stopping_criteria/_integral_variance_tol.py quad/solvers/stopping_criteria/_immediate_stop.py quad/solvers/stopping_criteria/_bq_stopping_criterion.py quad/solvers/bq_state.py quad/solvers/belief_updates/_belief_update.py quad/solvers/belief_updates/__init__.py quad/solvers/policies/_random_policy.py quad/solvers/policies/_policy.py quad/solvers/policies/__init__.py quad/solvers/__init__.py quad/kernel_embeddings/_matern_lebesgue.py quad/kernel_embeddings/_kernel_embedding.py quad/kernel_embeddings/_expquad_gauss.py quad/kernel_embeddings/_expquad_lebesgue.py quad/kernel_embeddings/__init__.py quad/_integration_measures.py quad/_bayesquad.py quad/_utils.py quad/__init__.py quad/_quad_typing.py functions/_function.py functions/_algebra_fallbacks.py functions/_algebra.py functions/_zero.py functions/__init__.py utils/linalg/_orthogonalize.py utils/linalg/_cholesky_updates.py utils/linalg/_inner_product.py utils/linalg/__init__.py utils/argutils.py utils/arrayutils.py utils/__init__.py _config.py _pnmethod/_stopping_criterion.py _pnmethod/_probabilistic_numerical_method.py _pnmethod/__init__.py typing.py __init__.py conftest.py

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.


@@ -6,7 +6,7 @@
Loading
6 6
functions with stochastic output.
7 7
"""
8 8
9 -
from . import kernels, mean_fns
9 +
from . import kernels
10 10
from ._gaussian_process import GaussianProcess
11 11
from ._random_process import RandomProcess
12 12

@@ -5,7 +5,7 @@
Loading
5 5
import numpy as np
6 6
import scipy.stats
7 7
8 -
from probnum import _function, randvars, utils
8 +
from probnum import functions, randvars, utils
9 9
from probnum.randprocs import _random_process, kernels
10 10
from probnum.randprocs.markov import _transition, continuous, discrete
11 11
from probnum.typing import ShapeLike
@@ -31,7 +31,7 @@
Loading
31 31
            input_shape=input_shape,
32 32
            output_shape=output_shape,
33 33
            dtype=np.dtype(np.float_),
34 -
            mean=_function.LambdaFunction(
34 +
            mean=functions.LambdaFunction(
35 35
                lambda x: self.__call__(args=x).mean,
36 36
                input_shape=input_shape,
37 37
                output_shape=output_shape,

@@ -0,0 +1,6 @@
Loading
1 +
"""Callables with in- and output shape information supporting algebraic operations."""
2 +
3 +
from . import _algebra
4 +
from ._algebra_fallbacks import ScaledFunction, SumFunction
5 +
from ._function import Function, LambdaFunction
6 +
from ._zero import Zero

@@ -3,12 +3,13 @@
Loading
3 3
from __future__ import annotations
4 4
5 5
import abc
6 +
import functools
6 7
from typing import Callable
7 8
8 9
import numpy as np
9 10
10 -
from . import utils
11 -
from .typing import ArrayLike, ShapeLike, ShapeType
11 +
from probnum import utils
12 +
from probnum.typing import ArrayLike, ShapeLike, ShapeType
12 13
13 14
14 15
class Function(abc.ABC):
@@ -17,6 +18,8 @@
Loading
17 18
    This class represents a, uni- or multivariate, scalar- or tensor-valued,
18 19
    mathematical function. Hence, the call method should not have any observable
19 20
    side-effects.
21 +
    Instances of this class can be added and multiplied by a scalar, which means that
22 +
    they are elements of a vector space.
20 23
21 24
    Parameters
22 25
    ----------
@@ -29,7 +32,7 @@
Loading
29 32
    See Also
30 33
    --------
31 34
    LambdaFunction : Define a :class:`Function` from an anonymous function.
32 -
    ~probnum.randprocs.mean_fns.Zero : Zero mean function of a random process.
35 +
    ~probnum.functions.Zero : Zero function.
33 36
    """
34 37
35 38
    def __init__(self, input_shape: ShapeLike, output_shape: ShapeLike = ()) -> None:
@@ -112,6 +115,39 @@
Loading
112 115
    def _evaluate(self, x: np.ndarray) -> np.ndarray:
113 116
        pass
114 117
118 +
    def __neg__(self):
119 +
        return -1.0 * self
120 +
121 +
    @functools.singledispatchmethod
122 +
    def __add__(self, other):
123 +
        return NotImplemented
124 +
125 +
    @functools.singledispatchmethod
126 +
    def __sub__(self, other):
127 +
        return NotImplemented
128 +
129 +
    @functools.singledispatchmethod
130 +
    def __mul__(self, other):
131 +
        if np.ndim(other) == 0:
132 +
            from ._algebra_fallbacks import (  # pylint: disable=import-outside-toplevel
133 +
                ScaledFunction,
134 +
            )
135 +
136 +
            return ScaledFunction(function=self, scalar=other)
137 +
138 +
        return NotImplemented
139 +
140 +
    @functools.singledispatchmethod
141 +
    def __rmul__(self, other):
142 +
        if np.ndim(other) == 0:
143 +
            from ._algebra_fallbacks import (  # pylint: disable=import-outside-toplevel
144 +
                ScaledFunction,
145 +
            )
146 +
147 +
            return ScaledFunction(function=self, scalar=other)
148 +
149 +
        return NotImplemented
150 +
115 151
116 152
class LambdaFunction(Function):
117 153
    """Define a :class:`Function` from a given :class:`callable`.
@@ -131,7 +167,7 @@
Loading
131 167
    Examples
132 168
    --------
133 169
    >>> import numpy as np
134 -
    >>> from probnum import LambdaFunction
170 +
    >>> from probnum.functions import LambdaFunction
135 171
    >>> fn = LambdaFunction(fn=lambda x: 2 * x + 1, input_shape=(2,), output_shape=(2,))
136 172
    >>> fn(np.array([[1, 2], [4, 5]]))
137 173
    array([[ 3,  5],

@@ -7,7 +7,7 @@
Loading
7 7
8 8
import numpy as np
9 9
10 -
from probnum import _function, randvars, utils as _utils
10 +
from probnum import functions, randvars, utils as _utils
11 11
from probnum.randprocs import kernels
12 12
from probnum.typing import DTypeLike, ShapeLike, ShapeType
13 13
@@ -56,7 +56,7 @@
Loading
56 56
        input_shape: ShapeLike,
57 57
        output_shape: ShapeLike,
58 58
        dtype: DTypeLike,
59 -
        mean: Optional[_function.Function] = None,
59 +
        mean: Optional[functions.Function] = None,
60 60
        cov: Optional[kernels.Kernel] = None,
61 61
    ):
62 62
        self._input_shape = _utils.as_shape(input_shape)
@@ -75,7 +75,7 @@
Loading
75 75
76 76
        # Mean function
77 77
        if mean is not None:
78 -
            if not isinstance(mean, _function.Function):
78 +
            if not isinstance(mean, functions.Function):
79 79
                raise TypeError("The mean function must have type `probnum.Function`.")
80 80
81 81
            if mean.input_shape != self._input_shape:
@@ -177,7 +177,7 @@
Loading
177 177
        raise NotImplementedError
178 178
179 179
    @property
180 -
    def mean(self) -> _function.Function:
180 +
    def mean(self) -> functions.Function:
181 181
        r"""Mean function :math:`m(x) := \mathbb{E}[f(x)]` of the random process."""
182 182
        if self._mean is None:
183 183
            raise NotImplementedError

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Learn more Showing 7 files with coverage changes found.

Changes in src/probnum/linops/_kronecker.py
-6
Loading file...
Changes in src/probnum/linops/_linear_operator.py
-1
Loading file...
New file src/probnum/functions/_algebra_fallbacks.py
New
Loading file...
New file src/probnum/functions/_algebra.py
New
Loading file...
New file src/probnum/functions/__init__.py
New
Loading file...
Changes in src/probnum/linops/_arithmetic.py
-3
-3
-3
Loading file...
Changes in src/probnum/randvars/_arithmetic.py
-2
-2
+2
Loading file...
Files Coverage
src/probnum 0.15% 90.28%
Project Totals (197 files) 90.28%
Loading