การจำแนกประเภท: Feature Engineering

ฝึกตอบคำถามสัมภาษณ์ Machine Learning ด้วย Python

Lisa Stuart

Data Scientist

Feature Engineering...ทำไมต้องใช้?

  • ดึงข้อมูลเพิ่มเติมออกจากข้อมูล
  • สร้าง feature ที่เกี่ยวข้องเพิ่มขึ้น
  • เป็นหนึ่งในวิธีที่มีประสิทธิภาพที่สุดในการปรับปรุงโมเดลเชิงทำนาย
ฝึกตอบคำถามสัมภาษณ์ Machine Learning ด้วย Python

ประโยชน์ของ Feature Engineering

  • เพิ่มพลังการทำนายของอัลกอริทึมการเรียนรู้
  • ช่วยให้โมเดล machine learning ทำงานได้ดียิ่งขึ้น!
ฝึกตอบคำถามสัมภาษณ์ Machine Learning ด้วย Python

ประเภทของ Feature Engineering

  • Indicator variables
  • Interaction features
  • Feature representation
ฝึกตอบคำถามสัมภาษณ์ Machine Learning ด้วย Python

Indicator Variables

  • ตัวแปรค่าขีดจำกัด
    • อายุ: มัธยมปลาย vs มหาวิทยาลัย
  • หลาย feature
    • ใช้เป็น flag
  • เหตุการณ์พิเศษ
    • Black Friday
    • คริสต์มาส
  • กลุ่มของ class
    • flag การเข้าชมเว็บแบบเสียเงิน
      • Google adwords{4}}
      • Facebook ads
ฝึกตอบคำถามสัมภาษณ์ Machine Learning ด้วย Python

Interaction Features

  • การบวก
  • การลบ
  • การคูณ
  • การหาร
  • การรวมกันทางคณิตศาสตร์อื่น ๆ
ฝึกตอบคำถามสัมภาษณ์ Machine Learning ด้วย Python

Feature Representation

  • Datetime stamps
    • วันในสัปดาห์
    • ชั่วโมงในวัน
  • จัดกลุ่ม categorical level ที่เหลือเป็น 'Other'
  • แปลง categorical เป็น dummy variables
    • (k - 1) binary columns
ฝึกตอบคำถามสัมภาษณ์ Machine Learning ด้วย Python

Categorical Levels ที่แตกต่างกัน

  • ข้อมูล training:
    • โมเดลฝึกด้วย [red, blue, green]
  • ข้อมูล test:

    • โมเดลทดสอบด้วย [red, green, yellow]
    • มีสีเพิ่มที่ไม่เคยเห็นในการฝึก
    • มีสีหนึ่งที่หายไป
  • Robust one-hot encoding

1 https://blog.cambridgespark.com/robust-one-hot-encoding-in-python-3e29bfcec77e
ฝึกตอบคำถามสัมภาษณ์ Machine Learning ด้วย Python

อัตราส่วนหนี้ต่อรายได้

  • Monthly Debt
  • Annual Income/12
ฝึกตอบคำถามสัมภาษณ์ Machine Learning ด้วย Python

ฟังก์ชัน Feature Engineering

ฟังก์ชัน ค่าที่คืนกลับ
sklearn.linear_model.LogisticRegression logistic regression
sklearn.model_selection.train_test_split ฟังก์ชันแบ่ง train/test
sns.countplot(x='Loan Status', data=data) bar plot
df.drop(['Feature 1', 'Feature 2'], axis=1) ลบรายการ feature
df["Loan Status"].replace({'Paid': 0, 'Not Paid': 1}) Loan Status เป็น integer
pd.get_dummies() k - 1 binary features
sklearn.metrics.accuracy_score(y_test, predict(X_test)) ความแม่นยำของโมเดล
ฝึกตอบคำถามสัมภาษณ์ Machine Learning ด้วย Python

บทความแนะนำ:

ฝึกตอบคำถามสัมภาษณ์ Machine Learning ด้วย Python

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

ฝึกตอบคำถามสัมภาษณ์ Machine Learning ด้วย Python

Preparing Video For Download...