1. Learn
  2. /
  3. Courses
  4. /
  5. Designing Machine Learning Workflows in Python

Connected

Exercise

Three novelty detectors

Finally, you know enough to run some tests on the use of a few anomaly detectors on the arrhythmia dataset. To test their performance, you will train them on an unlabeled training dataset, but then compare their predictions to the ground truth on the test data using their method .score_samples(). This time, you will be asked to import the detectors as part of the exercise, but you do have the data X_train, X_test, y_train, y_test preloaded as usual.

Instructions 1/3

undefined XP
  • 1
    • Import the one-class SVM detector from the svm module as onesvm, fit it to the training data, and score the test data.
  • 2
    • Adapt your code to import the isolation forest from the ensemble module as isof, fit it and score the test data.
  • 3
    • Adapt your code to import the LocalOutlierFactor module as lof, fit it to the training data, and score the test data.