การออกแบบ Machine Learning Workflows ด้วย Python
Dr. Chris Anagnostopoulos
Honorary Associate Professor
ระดับของความจริง:
เลเบลที่ไม่มีสัญญาณรบกวน หรือ strong labels:
เลเบลที่มีสัญญาณรบกวน หรือ weak labels:
การสร้าง feature:
ค่าเฉลี่ยของพอร์ตที่ไม่ซ้ำกันที่แต่ละโฮสต์ที่ติดมัลแวร์เยี่ยมชม:
np.mean(X[y]['unique_ports'])
15.11
ค่าเฉลี่ยของพอร์ตที่ไม่ซ้ำกันต่อโฮสต์โดยไม่คำนึงถึงเลเบล:
np.mean(X['unique_ports'])
11.23
แปลง feature ให้เป็น heuristic สำหรับติดเลเบล:
X_train, X_test, y_train, y_test = train_test_split(X, y)
y_weak_train = X_train['unique_ports'] > 15


X_train_aug = pd.concat([X_train, X_train])
y_train_aug = pd.concat([pd.Series(y_train), pd.Series(y_weak_train)])

weights = [1.0]*len(y_train) + [0.1]*len(y_weak_train)
ความแม่นยำเมื่อใช้ ground truth เพียงอย่างเดียว:
0.91
Ground truth และ weak labels โดยไม่มีน้ำหนัก:
accuracy_score(y_test, clf.fit(X_train_aug, y_train_aug).predict(X_test))
0.93
เพิ่มน้ำหนัก:
accuracy_score(y_test, clf.fit(X_train_aug, y_train_aug, sample_weight=weights).predict(X_test))
0.95
การออกแบบ Machine Learning Workflows ด้วย Python