I'm trying to calculate ROCAUC
after running fit_predict for a LOF model on a dataset.
I am using sklearn
for the LOF implementation. I recognize I can get scores back by calling model.negative_outlier_factor_
but I am not sure how to transform these scores into probabilities to do an AUC
calculation
This is for comparison to another model. How should I go about doing this?
You don't have to convert the model.negative_outlier_factor_ into probabilities for ROC_AUC calculation, just a relative score will be good enough.
samples = [[0., 0., 0.], [0., .5, 0.], [1., 1., .5]]
from sklearn.neighbors import LocalOutlierFactor
lof = LocalOutlierFactor(n_neighbors=3,novelty=True)
lof.fit(samples)
roc_auc(1/lof.score_samples(X_test),y_test)