interface#
import tensorwaves.interface
Defines top-level interface of tensorwaves.
- InputType#
The argument type of a
Function.__call__()
.alias of TypeVar(‘InputType’)
- OutputType#
The return type of a
Function.__call__()
.alias of TypeVar(‘OutputType’)
- class Function(*args, **kwds)[source]#
Bases:
ABC
,Generic
[InputType
,OutputType
]Generic representation of a mathematical function.
Representation of a mathematical function that computes
OutputType
values (co-domain) for a given set ofInputType
values (domain). Examples ofFunction
areParametrizedFunction
,Estimator
andDataTransformer
.- abstract __call__(data: InputType) OutputType [source]#
Call self as a function.
- class ParametrizedFunction(*args, **kwds)[source]#
Bases:
Function
[Dict
[str
,ndarray
],ndarray
]Interface of a callable function.
A
ParametrizedFunction
identifies certain variables in a mathematical expression as parameters. Remaining variables are considered domain variables. Domain variables are the argument of the evaluation (see__call__()
), while the parameters are controlled viaparameters
(getter) andupdate_parameters()
(setter). This mechanism is especially important for anEstimator
.- abstract __call__(data: InputType) OutputType #
Call self as a function.
- abstract property parameters: dict[str, ParameterValue]#
Get
dict
of parameters.
- class DataTransformer(*args, **kwds)[source]#
Bases:
Function
[Dict
[str
,ndarray
],Dict
[str
,ndarray
]]Transform one
DataSample
into anotherDataSample
.This changes the keys and values of the input
DataSample
to a specific outputDataSample
structure.
- class Estimator(*args, **kwds)[source]#
Bases:
Function
[Mapping
[str
,Union
[complex
,float
]],float
]Estimator for discrepancy model and data.
See the
estimator
module for different implementations of this interface.- abstract __call__(parameters: Mapping[str, ParameterValue]) float [source]#
Compute estimator value for this combination of parameter values.
- abstract gradient(parameters: Mapping[str, ParameterValue]) dict[str, ParameterValue] [source]#
Calculate gradient for given parameter mapping.
- class FitResult(minimum_valid: bool, execution_time: float, function_calls: int, estimator_value: float, parameter_values: dict[str, ParameterValue] = None, parameter_errors: dict[str, ParameterValue] | None = None, iterations: int | None = None, specifics: Any | None = None)[source]#
Bases:
object
- parameter_values: dict[str, ParameterValue]#
- parameter_errors: dict[str, ParameterValue] | None#
- specifics: Any | None#
Any additional info provided by the specific optimizer.
An instance returned by one of the implemented optimizers under the
optimizer
module. Currently one of:This way, you can for instance get the
covariance
matrix. See also Covariance matrix.
- class Optimizer[source]#
Bases:
ABC
Optimize a fit model to a data set.
See the
optimizer
module for different implementations of this interface.
- class RealNumberGenerator[source]#
Bases:
ABC
Abstract class for generating real numbers within a certain range.
Implementations can be found in the
tensorwaves.data
module.
- class DataGenerator[source]#
Bases:
ABC
Abstract class for generating a
DataSample
.- abstract generate(size: int, rng: RealNumberGenerator) DataSample [source]#
Generate a
DataSample
withsize
events.- Returns:
A
tuple
of aDataSample
with an array of weights.