การทำงานกับผลลัพธ์แบบคำนวณและแบบประมาณ

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

Maciej Balawejder

Data Scientist

จะแบ่ง chunk ข้อมูลอย่างไร?

ภาพแสดงการแบ่ง chunk 3 ประเภท ได้แก่ แบบตามประเภท แบบตามขนาด และแบบตามจำนวน

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

การระบุ chunk ในรูปแบบต่าง ๆ

ภาพแสดง alias การแบ่ง chunk ตามช่วงเวลา ที่ใช้เป็นอาร์กิวเมนต์สำหรับพารามิเตอร์ช่วง chunk

# Initialize the algorithm
cbpe = nannyml.CBPE(
   problem_type='classification_binary',
   y_pred_proba='predicted_probability',
   y_pred='prediction',
   y_true='employed',
   metrics=['roc_auc'],
   chunk_period='m',
   # chunk_size = 5000, 
   # chunk_number = 10
)
การติดตามตรวจสอบ Machine Learning ด้วย Python

การกำหนดเกณฑ์แบบกำหนดเอง

เกณฑ์ส่วนเบี่ยงเบนมาตรฐาน

  • กำหนดตัวคูณส่วนเบี่ยงเบนมาตรฐานบนและล่างด้วยตนเอง
# Standard deviation thresholds
stdt = StandardDeviationThreshold(
    std_lower_multiplier=3, 
    std_upper_multiplier=3
    )

เกณฑ์แบบคงที่

  • กำหนดค่าเกณฑ์บนและล่างด้วยตนเอง
# Constant thresholds
ct = ConstantThreshold(
    lower=0.85, 
    upper=0.95
    )
การติดตามตรวจสอบ Machine Learning ด้วย Python

การระบุเกณฑ์แบบกำหนดเอง

# Import threshold methods(last slide)
from nannyml.thresholds import ConstantThreshold, StandardDeviationThreshold

# Passing thresholds to the CBPE algorithm
estimator = nannyml.CBPE(...
    metrics = ['roc_auc', 'accuracy'],
    thresholds={'roc_auc': ct, 'accuracy' : stdt}
)

ภาพแสดงกราฟประสิทธิภาพที่ประมาณได้สำหรับเมตริก ROC AUC และ accuracy พร้อมเกณฑ์แบบกำหนดเอง

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

การกรองผลลัพธ์

  • ตามช่วงเวลา
    filtered_results = results.filter(period='analysis')
    
  • ตามเมตริก

    filtered_results = results.filter(metrics=['mae'])
    
  • ทั้งสองแบบ

    filtered_results = results.filter(period='analysis', metrics=['mae'])
    
การติดตามตรวจสอบ Machine Learning ด้วย Python

ส่งออกผลลัพธ์เป็น dataframe

# Export results to dataframe format
results.filter(period='analysis').to_df()

ภาพแสดงผลลัพธ์ในรูปแบบ dataframe

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

มาฝึกกันเถอะ!

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

Preparing Video For Download...