22
33from abc import ABCMeta , abstractmethod
44from functools import lru_cache
5+ from typing import Any
56
67import numpy as np
78
89from dpdata .system import LabeledSystem , MultiSystems
910
1011
11- def mae (errors : np .ndarray ) -> np .float64 :
12+ def mae (errors : np .ndarray ) -> np .floating [ Any ] :
1213 """Compute the mean absolute error (MAE).
1314
1415 Parameters
@@ -18,13 +19,13 @@ def mae(errors: np.ndarray) -> np.float64:
1819
1920 Returns
2021 -------
21- np.float64
22+ floating[Any]
2223 mean absolute error (MAE)
2324 """
2425 return np .mean (np .abs (errors ))
2526
2627
27- def rmse (errors : np .ndarray ) -> np .float64 :
28+ def rmse (errors : np .ndarray ) -> np .floating [ Any ] :
2829 """Compute the root mean squared error (RMSE).
2930
3031 Parameters
@@ -34,7 +35,7 @@ def rmse(errors: np.ndarray) -> np.float64:
3435
3536 Returns
3637 -------
37- np.float64
38+ floating[Any]
3839 root mean squared error (RMSE)
3940 """
4041 return np .sqrt (np .mean (np .square (errors )))
@@ -74,22 +75,22 @@ def f_errors(self) -> np.ndarray:
7475 """Force errors."""
7576
7677 @property
77- def e_mae (self ) -> np .float64 :
78+ def e_mae (self ) -> np .floating [ Any ] :
7879 """Energy MAE."""
7980 return mae (self .e_errors )
8081
8182 @property
82- def e_rmse (self ) -> np .float64 :
83+ def e_rmse (self ) -> np .floating [ Any ] :
8384 """Energy RMSE."""
8485 return rmse (self .e_errors )
8586
8687 @property
87- def f_mae (self ) -> np .float64 :
88+ def f_mae (self ) -> np .floating [ Any ] :
8889 """Force MAE."""
8990 return mae (self .f_errors )
9091
9192 @property
92- def f_rmse (self ) -> np .float64 :
93+ def f_rmse (self ) -> np .floating [ Any ] :
9394 """Force RMSE."""
9495 return rmse (self .f_errors )
9596
0 commit comments