summaryrefslogtreecommitdiff
path: root/src/python/gudhi/point_cloud
diff options
context:
space:
mode:
authorHind-M <hind.montassif@gmail.com>2021-10-25 10:23:45 +0200
committerHind-M <hind.montassif@gmail.com>2021-10-25 10:23:45 +0200
commit0bf357f6346fab6edf96d580a9195c2acbb79bae (patch)
treef09ebd703694a5d964f271bd286383627d618f7f /src/python/gudhi/point_cloud
parent00dc44281f59aa2b7bb612ec2a7f46720bb944f9 (diff)
Revert "Add warnings in dtm.py for DistanceToMeasure and DTMDensity"
This reverts commit f461f050ee8bad509814b4851ab7ae8f43502962.
Diffstat (limited to 'src/python/gudhi/point_cloud')
-rw-r--r--src/python/gudhi/point_cloud/dtm.py11
1 files changed, 0 insertions, 11 deletions
diff --git a/src/python/gudhi/point_cloud/dtm.py b/src/python/gudhi/point_cloud/dtm.py
index 96a9e7bf..55ac58e6 100644
--- a/src/python/gudhi/point_cloud/dtm.py
+++ b/src/python/gudhi/point_cloud/dtm.py
@@ -9,7 +9,6 @@
from .knn import KNearestNeighbors
import numpy as np
-import warnings
__author__ = "Marc Glisse"
__copyright__ = "Copyright (C) 2020 Inria"
@@ -67,11 +66,6 @@ class DistanceToMeasure:
distances = distances ** self.q
dtm = distances.sum(-1) / self.k
dtm = dtm ** (1.0 / self.q)
- with warnings.catch_warnings():
- import torch
- if isinstance(dtm, torch.Tensor):
- if not(torch.isfinite(dtm).all()):
- warnings.warn("Overflow/infinite value encountered while computing 'dtm'", RuntimeWarning)
# We compute too many powers, 1/p in knn then q in dtm, 1/q in dtm then q or some log in the caller.
# Add option to skip the final root?
return dtm
@@ -169,11 +163,6 @@ class DTMDensity:
distances = self.knn.transform(X)
distances = distances ** q
dtm = (distances * weights).sum(-1)
- with warnings.catch_warnings():
- import torch
- if isinstance(dtm, torch.Tensor):
- if not(torch.isfinite(dtm).all()):
- warnings.warn("Overflow/infinite value encountered while computing 'dtm' for density", RuntimeWarning)
if self.normalize:
dtm /= (np.arange(1, k + 1) ** (q / dim) * weights).sum()
density = dtm ** (-dim / q)