mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-06 05:14:38 +08:00
PRF: Added nanmean, nanstd, nansum that will default to bottleneck if available
This commit is contained in:
@@ -14,7 +14,22 @@
|
||||
# limitations under the License.
|
||||
|
||||
import math
|
||||
import numpy as np
|
||||
|
||||
|
||||
def tolerant_equals(a, b, atol=10e-7, rtol=10e-7):
|
||||
return math.fabs(a - b) <= (atol + rtol * math.fabs(b))
|
||||
|
||||
|
||||
nanmean = np.nanmean
|
||||
nanstd = np.nanstd
|
||||
nansum = np.nansum
|
||||
|
||||
|
||||
try:
|
||||
import bottleneck as bn
|
||||
nanmean = bn.nanmean
|
||||
nanstd = bn.nanstd
|
||||
nansum = bn.nansum
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user