三種新穎性偵測器
最後,你已經準備好在心律不整資料集上測試幾種異常偵測器的用法。為了評估效能,你會先在未標記的訓練資料集上訓練它們,接著使用 .score_samples() 方法,將它們在測試資料上的預測與真實標籤比較。這次練習需要你自行匯入偵測器;不過資料 X_train、X_test、y_train、y_test 已如往常預先載入。
本練習屬於課程
在 Python 設計機器學習工作流程
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Import the novelty detector
from sklearn.____ import ____ as onesvm
# Fit it to the training data and score the test data
svm_detector = ____.____(X_train)
scores = svm_detector.____(X_test)