การตรวจจับความผิดปกติใหม่

การออกแบบ Machine Learning Workflows ด้วย Python

Dr. Chris Anagnostopoulos

Honorary Associate Professor

การจำแนกแบบ one-class

ข้อมูล Training ที่ไม่มี anomaly:

กลุ่มจุดสีดำสองกลุ่ม

ข้อมูล อนาคต / test ที่มี anomaly:

กลุ่มจุดสีดำสองกลุ่มพร้อมจุดที่กระจายอยู่ต่างหาก

การออกแบบ Machine Learning Workflows ด้วย Python

Novelty LoF

วิธีแก้ปัญหาเบื้องต้น

preds = lof().fit_predict(
   np.concatenate([X_train, X_test]))

preds = preds[X_train.shape[0]:]

กลุ่มจุดสีดำสองกลุ่มพร้อมจุดสีแดงที่กระจายอยู่

Novelty LoF

clf = lof(novelty=True)

clf.fit(X_train) y_pred = clf.predict(X_test)

กลุ่มจุดสีดำสองกลุ่มพร้อมจุดสีแดงที่กระจายอยู่

การออกแบบ Machine Learning Workflows ด้วย Python

One-class Support Vector Machine

clf = OneClassSVM()

clf.fit(X_train) y_pred = clf.predict(X_test)
y_pred[:4]
array([ 1,  1,  1, -1])

กลุ่มจุดสองกลุ่มพร้อมจุดที่กระจายอยู่ต่างหาก โดยส่วนใหญ่เป็นสีแดงทั้งในกลุ่มและจุดที่กระจายอยู่

การออกแบบ Machine Learning Workflows ด้วย Python

One-class Support Vector Machine

clf = OneClassSVM()
clf.fit(X_train)
y_scores = clf.score_samples(X_test)

threshold = np.quantile(y_scores, 0.1)
y_pred = y_scores <= threshold

กลุ่มจุดสีดำสองกลุ่มพร้อมจุดสีแดงที่กระจายอยู่

การออกแบบ Machine Learning Workflows ด้วย Python

Isolation Forests

clf = IsolationForest()
clf.fit(X_train)
y_scores = clf.score_samples(X_test)
clf = LocalOutlierFactor(novelty=True)
clf.fit(X_train)
y_scores = clf.score_samples(X_test)

กลุ่มจุดสีดำสองกลุ่มพร้อมจุดสีแดงที่กระจายอยู่

การออกแบบ Machine Learning Workflows ด้วย Python
clf_lof = LocalOutlierFactor(novelty=True).fit(X_train)
clf_isf = IsolationForest().fit(X_train)
clf_svm = OneClassSVM().fit(X_train)
roc_auc_score(y_test, clf_lof.score_samples(X_test)
0.9897
roc_auc_score(y_test, clf_isf.score_samples(X_test))
0.9692
roc_auc_score(y_test, clf_svm.score_samples(X_test))
0.9948
การออกแบบ Machine Learning Workflows ด้วย Python
clf_lof = LocalOutlierFactor(novelty=True).fit(X_train)
clf_isf = IsolationForest().fit(X_train)
clf_svm = OneClassSVM().fit(X_train)
accuracy_score(y_test, clf_lof.predict(X_test))
0.9318
accuracy_score(y_test, clf_isf.predict(X_test))
0.9545
accuracy_score(y_test, clf_svm.predict(X_test))
0.5
การออกแบบ Machine Learning Workflows ด้วย Python

มีอะไรใหม่?

การออกแบบ Machine Learning Workflows ด้วย Python

Preparing Video For Download...