interface
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
OutputTypevalues (co-domain) for a given set ofInputTypevalues (domain). Examples ofFunctionareParametrizedFunction,EstimatorandDataTransformer.- 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
ParametrizedFunctionidentifies 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
dictof parameters.
- class DataTransformer(*args, **kwds)[source]#
Bases:
Function[Dict[str,ndarray],Dict[str,ndarray]]Transform one
DataSampleinto anotherDataSample.This changes the keys and values of the input
DataSampleto a specific outputDataSamplestructure.
- class Estimator(*args, **kwds)[source]#
Bases:
Function[Mapping[str,Union[complex,float]],float]Estimator for discrepancy model and data.
See the
estimatormodule for different implementations of this interface.- __call__(parameters: ~typing.Mapping[str, <sphinx.util.inspect.TypeAliasForwardRef object at 0x7f18d80a73a0>]) 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
optimizermodule. Currently one of:This way, you can for instance get the
covariancematrix. See also Covariance matrix.
- class Optimizer[source]#
Bases:
ABCOptimize a fit model to a data set.
See the
optimizermodule for different implementations of this interface.
- class RealNumberGenerator[source]#
Bases:
ABCAbstract class for generating real numbers within a certain range.
Implementations can be found in the
tensorwaves.datamodule.
- class DataGenerator[source]#
Bases:
ABCAbstract class for generating a
DataSample.- abstract generate(size: int, rng: RealNumberGenerator) DataSample[source]#
Generate a
DataSamplewithsizeevents.- Returns
A
tupleof aDataSamplewith an array of weights.