Aan de slagGa gratis aan de slag

LoF contamination

Your medical advisor at the arrhythmia startup informs you that your training data might not contain all possible types of arrhythmia. How on earth will you detect these other types without any labeled examples? Could an anomaly detector tell the difference between healthy and unhealthy without access to labels? But first, you experiment with the contamination parameter to see its effect on the confusion matrix. You have LocalOutlierFactor as lof, numpy as np, the labels as ground_truth encoded in -1and 1 just like local outlier factor output, and the unlabeled training data as X.

Deze oefening maakt deel uit van de cursus

Designing Machine Learning Workflows in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Fit the local outlier factor and output predictions
preds = lof().____(X)

# Print the confusion matrix
print(____(ground_truth, preds))
Code bewerken en uitvoeren