Skip to content

Commit

Permalink
Drift detection workflow - test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
albertovalerio committed Dec 25, 2023
1 parent 14adfdd commit 086d068
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/features/drift_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,28 @@ def detect(debug=False):

is_drift = np.array([train_preds_low['data']['is_drift'], test_preds_low['data']['is_drift']])

if debug == True:
log = open(LOG_FILE, 'a', encoding='utf-8')
if is_drift.any():
if train_preds_low['data']['is_drift']:
log = open(LOG_FILE, 'a', encoding='utf-8')
if is_drift.any():
if train_preds_low['data']['is_drift']:
if debug == True:
file = [txt for txt in feat_files if 'train' in txt]
os.unlink(EMB_PATH + '/' + file[0])
with open(EMB_PATH + '/' + str(ts) + '-alibi-detect-train-features.txt', 'w', encoding='utf-8') as f:
for value in hist_avg_train:
f.write(f"{value}\n")
log.write('['+dt+'] ALIBI.DETECT: drift detected on training set.\n')
if test_preds_low['data']['is_drift']:
log.write('['+dt+'] ALIBI.DETECT: drift detected on training set.\n')
if test_preds_low['data']['is_drift']:
if debug == True:
file = [txt for txt in feat_files if 'test' in txt]
os.unlink(EMB_PATH + '/' + file[0])
with open(EMB_PATH + '/' + str(ts) + '-alibi-detect-test-features.txt', 'w', encoding='utf-8') as f:
for value in hist_avg_test:
f.write(f"{value}\n")
log.write('['+dt+'] ALIBI.DETECT: drift detected on testing set.\n')
else:
log.write('['+dt+'] ALIBI.DETECT: no drift detected. \n')
log.flush()
log.close()
log.write('['+dt+'] ALIBI.DETECT: drift detected on testing set.\n')
else:
log.write('['+dt+'] ALIBI.DETECT: no drift detected. \n')
log.flush()
log.close()

return is_drift.any()

Expand Down

0 comments on commit 086d068

Please sign in to comment.