Machine learning กับ scikit-learn

Supervised Learning ด้วย scikit-learn

George Boorman

Core Curriculum Manager, DataCamp

Machine learning คืออะไร?

  • Machine learning คือกระบวนการที่:
    • คอมพิวเตอร์เรียนรู้การตัดสินใจจากข้อมูลได้
    • โดยไม่ต้องเขียนโปรแกรมบอกทุกขั้นตอน!
Supervised Learning ด้วย scikit-learn

ตัวอย่างของ machine learning

ไอคอนอีเมล

หนังสือ

Supervised Learning ด้วย scikit-learn

Unsupervised learning

  • ค้นหารูปแบบที่ซ่อนอยู่จากข้อมูลที่ไม่มีป้ายกำกับ

  • ตัวอย่าง:

    • จัดกลุ่มลูกค้าออกเป็นหมวดหมู่ต่าง ๆ (Clustering)

การวิเคราะห์กลุ่ม

Supervised Learning ด้วย scikit-learn

Supervised learning

  • ค่าที่ต้องการพยากรณ์เป็นที่รู้อยู่แล้ว

  • เป้าหมาย: พยากรณ์ค่าเป้าหมายของข้อมูลใหม่จาก feature ที่มี

 

feature และตัวแปรเป้าหมาย

Supervised Learning ด้วย scikit-learn

ประเภทของ supervised learning

  • Classification: ตัวแปรเป้าหมายเป็นหมวดหมู่

ตู้ ATM

  • Regression: ตัวแปรเป้าหมายเป็นค่าต่อเนื่อง

 

อสังหาริมทรัพย์

Supervised Learning ด้วย scikit-learn

ข้อตกลงในการตั้งชื่อ

  • Feature = predictor variable = independent variable

  • Target variable = dependent variable = response variable

 

feature และตัวแปรเป้าหมาย

Supervised Learning ด้วย scikit-learn

ก่อนใช้ supervised learning

  • ข้อกำหนด:
    • ไม่มีค่าที่ขาดหาย
    • ข้อมูลอยู่ในรูปแบบตัวเลข
    • ข้อมูลเก็บใน pandas DataFrame หรือ NumPy array

 

  • ทำ Exploratory Data Analysis (EDA) ก่อนเสมอ
Supervised Learning ด้วย scikit-learn

ไวยากรณ์ของ scikit-learn

from sklearn.module import Model

model = Model()
model.fit(X, y)
predictions = model.predict(X_new)
print(predictions)
array([0, 0, 0, 0, 1, 0])
Supervised Learning ด้วย scikit-learn

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

Supervised Learning ด้วย scikit-learn

Preparing Video For Download...