Skip to content

Commit

Permalink
store kdq-tree test statistic (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
tms-bananaquit committed May 31, 2023
1 parent 1da1efd commit 00f7d1e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions menelaus/data_drift/kdq_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def __init__(
self.bootstrap_samples = bootstrap_samples
self.count_ubound = count_ubound
self.cutpoint_proportion_lbound = cutpoint_proportion_lbound
self._test_dist = None
self._critical_dist = None

def reset(self):
"""
Expand All @@ -99,6 +101,7 @@ def reset(self):
self._test_data_size = 0
self._kdqtree = None
self._critical_dist = None
self._test_dist = None

def _evaluate_kdqtree(self, ary, input_type):
"""
Expand Down Expand Up @@ -135,6 +138,7 @@ def _evaluate_kdqtree(self, ary, input_type):
# window is full, or we're doing batch detection
if input_type == "batch" or (self._test_data_size >= self.window_size):
test_dist = self._kdqtree.kl_distance(tree_id1="build", tree_id2="test")
self._test_dist = test_dist
if test_dist > self._critical_dist:
if input_type == "stream":
self._drift_counter += 1
Expand Down

0 comments on commit 00f7d1e

Please sign in to comment.