Skip to content

Instantly share code, notes, and snippets.

@lynnssi
Created December 1, 2021 01:37
Show Gist options
  • Save lynnssi/28c1151596b9cfa3118a182c852a238d to your computer and use it in GitHub Desktop.
Save lynnssi/28c1151596b9cfa3118a182c852a238d to your computer and use it in GitHub Desktop.
from pyod.models.lof import LOF
clf_name = 'LOF'
clf = LOF()
clf.fit(X_train)
test_scores = clf.decision_function(X_test)
roc = round(roc_auc_score(y_test, test_scores), ndigits=4)
prn = round(precision_n_scores(y_test, test_scores), ndigits=4)
print(f'{clf_name} ROC:{roc}, precision @ rank n:{prn}')
>> LOF ROC:0.9656, precision @ rank n:0.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment