From 87c85e46645f8b63ca5b5fbece4372c876c084c3 Mon Sep 17 00:00:00 2001 From: Axel Nilsson Date: Sun, 4 Feb 2024 20:19:08 +0100 Subject: [PATCH] Updated mypy configuration. --- mypy.ini | 4 ++-- src/abacus/models/garch.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mypy.ini b/mypy.ini index b7e131d..ff6c62b 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,6 +1,6 @@ [mypy] warn_unused_configs = True -files = src/models +files = src ignore_missing_imports = True check_untyped_defs = True explicit_package_bases = True @@ -8,5 +8,5 @@ warn_unreachable = True warn_redundant_casts = True warn_unused_ignores = True follow_imports_for_stubs = False -disable_error_code=assignment, has-type, union-attr, arg-type, attr-defined +disable_error_code=assignment, has-type, union-attr, arg-type, attr-defined, return plugins = numpy.typing.mypy_plugin diff --git a/src/abacus/models/garch.py b/src/abacus/models/garch.py index 669e470..8ca1d5e 100644 --- a/src/abacus/models/garch.py +++ b/src/abacus/models/garch.py @@ -16,7 +16,7 @@ def __init__(self, data: torch.Tensor): super().__init__(data) @property - def parameters(self) -> tuple[float, 3]: + def parameters(self) -> tuple[float, ...]: self._check_calibration() optimal_parameters = self._optimal_parameters @@ -31,11 +31,11 @@ def _number_of_parameters(self) -> int: return len(self.parameters) @property - def _optimal_parameters(self) -> np.array: + def _optimal_parameters(self) -> np.ndarray: return self._uncondition_parameters(parameters=torch.tensor(self._solution.x)).numpy() @property - def _inital_solution(self) -> np.array: + def _inital_solution(self) -> np.ndarray: return np.array(self._precondition_parameters(parameters=torch.tensor(INITIAL_GARCH_PARAMETERS))) @property @@ -83,7 +83,7 @@ def transform_to_uniform(self): return Normal(0, 1).cdf(residuals) - def _cost_function(self, parameters: np.array) -> tuple[float, 2]: + def _cost_function(self, parameters: np.array) -> tuple[float, ...]: """ Defines the conditional log loss for the GARCH model. Calculates the loss recursively.