Skip to content

Commit

Permalink
Update psi_detector.py
Browse files Browse the repository at this point in the history
  • Loading branch information
951378644 authored Nov 22, 2023
1 parent 1530e7f commit 9bf792a
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions menelaus/data_drift/psi_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,10 @@ def update(self, X: np.array, y_true=None, y_pred=None):
grp_new = df_new.groupby("bin").count()
grp_new["percent_new"] = grp_new["new"] / sum(grp_new["new"])
psi_value = self._PSI(grp_initial, grp_new)
self._PSI_value = psi_value
if psi_value >= self.threshold:
self._drift_state = "drift"
self.set_reference(test_batch)

return psi_value
def _bin_data(self, feature, min, max):
"""
Bin the given feature based on the specified minimum and maximum values.
Expand Down Expand Up @@ -143,12 +142,3 @@ def _PSI(self, reference_feature, test_feature):
psi_df["percent_initial"] / psi_df["percent_new"]
)
return np.mean(psi_df["psi"])

def _PSI_value(self):
"""
Get the last calculated PSI value.
Returns:
float: The PSI value from the most recent update.
"""
return self.PSI_value

0 comments on commit 9bf792a

Please sign in to comment.