Skip to content

Commit 4b5a5a6

Browse files
committed
Fix type errors in KLDivergence_entropy.py
1 parent 01ade80 commit 4b5a5a6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pysatl_cpd/core/algorithms/entropies/KLDivergence_entropy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections import deque
2-
from typing import Optional
2+
from typing import Any, Optional
33

44
import numpy as np
55
import numpy.typing as npt
@@ -102,8 +102,8 @@ def _calculate_kl_divergence(self) -> float:
102102
def _calculate_kl_divergence_histogram(
103103
self, ref_data: npt.NDArray[np.float64], curr_data: npt.NDArray[np.float64]
104104
) -> float:
105-
data_min = float(np.min(ref_data))
106-
data_max = float(np.max(ref_data))
105+
data_min = float(np.min(np.array([ref_data.min(), curr_data.min()])))
106+
data_max = float(np.max(np.array([ref_data.max(), curr_data.max()])))
107107

108108
margin = (data_max - data_min) * 0.01
109109
bin_edges = np.linspace(data_min - margin, data_max + margin, self._num_bins + 1)
@@ -225,7 +225,7 @@ def get_distribution_comparison(self) -> dict[str, float]:
225225
"ks_pvalue": ks_pvalue,
226226
}
227227

228-
def analyze_distributions(self) -> dict[str, float]:
228+
def analyze_distributions(self) -> dict[str, Any]:
229229
if len(self._reference_buffer) < self._reference_window_size or len(self._current_buffer) < self._window_size:
230230
return {}
231231

0 commit comments

Comments
 (0)