เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

การปรับแต่ง Threshold

ในวิดีโอ คุณได้เรียนรู้วิธีที่ NannyML คำนวณค่า threshold และวิธีปรับแต่งให้เหมาะกับโซลูชันของคุณ

ในแบบฝึกหัดนี้ ให้กำหนด custom threshold 2 แบบ ได้แก่ แบบ standard deviation และแบบ constant จากนั้นนำไปใช้กับผลลัพธ์จากอัลกอริทึม CBPE สำหรับชุดข้อมูล US Census

ชุดข้อมูล reference และ analysis ถูกโหลดไว้ล่วงหน้าในตัวแปร reference และ analysis พร้อมกับไลบรารี nannyml

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

การติดตามตรวจสอบ Machine Learning ด้วย Python

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Import ConstantThreshold และ StandardDeviationThreshold จาก nannyml.thresholds
  • เริ่มต้นใช้วิธี standard deviation และกำหนดพารามิเตอร์ std_lower_multiplier และ std_upper_multiplier เป็น 2
  • เริ่มต้นใช้วิธี constant threshold และกำหนด lower เป็น 0.9 และ upper เป็น 0.98
  • ส่ง constant threshold สำหรับ metric f1 และ standard deviation สำหรับ accuracy ไปยังอัลกอริทึม CBPE

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Import custom thresholds
from ____.____ import ____, ____

# Initialize custom thresholds
stdt = ____(____=____, ____=____)
ct = ____(____=____, ____=____)

# Initialize the CBPE algorithm
estimator = nannyml.CBPE(
    problem_type='classification_binary',
    y_pred_proba='predicted_probability',
    y_pred='prediction',
    y_true='employed',
    metrics=['roc_auc', 'accuracy', 'f1'],
    thresholds={____: ____, ____: ____})
แก้ไขและรันโค้ด