Skip to content

Commit

Permalink
Merge branch 'main' into feat/distribution-calculators
Browse files Browse the repository at this point in the history
  • Loading branch information
nnansters committed Jan 17, 2024
2 parents 0d0fd8d + aad7edf commit 60a2597
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions nannyml/drift/univariate/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,14 @@ def __init__(self, **kwargs) -> None:
self._p_value: float
self._fitted = False

def fit(self, reference_data: pd.Series, timestamps: Optional[pd.Series] = None) -> Self:
super().fit(reference_data, timestamps)

# Thresholding is based on p-values. Ignoring all custom thresholding and disable plotting a threshold
self.lower_threshold_value = None
self.upper_threshold_value = None
return self

def _fit(self, reference_data: pd.Series, timestamps: Optional[pd.Series] = None) -> Self:
reference_data = _remove_nans(reference_data)
self._reference_data_vcs = reference_data.value_counts().loc[lambda v: v != 0]
Expand All @@ -462,9 +470,6 @@ def _calculate(self, data: pd.Series):
return stat

def alert(self, value: float):
self.lower_threshold_value = None # ignoring all custom thresholding, disable plotting a threshold
self.upper_threshold_value = None # ignoring all custom thresholding, disable plotting a threshold

return self._p_value < 0.05

def _calc_chi2(self, data: pd.Series):
Expand Down

0 comments on commit 60a2597

Please sign in to comment.