Vì sao tạo đặc trưng?

Feature Engineering cho Machine Learning bằng Python

Robert O'Callaghan

Director of Data Science, Ordergroove

Kỹ thuật đặc trưng

Feature Engineering cho Machine Learning bằng Python

Các kiểu dữ liệu

  • Liên tục: số nguyên hoặc số thực (thập phân)
  • Phân loại: chọn từ tập giá trị hữu hạn, ví dụ: giới tính, quốc gia sinh
  • Thứ bậc: giá trị có thứ hạng, thường không biết khoảng cách giữa hạng
  • Boolean: giá trị True/False
  • Datetime: ngày và giờ
Feature Engineering cho Machine Learning bằng Python

Cấu trúc khóa học

  • Chương 1: Tạo và trích xuất đặc trưng

  • Chương 2: Xử lý dữ liệu lộn xộn

  • Chương 3: Chuẩn hóa đặc trưng

  • Chương 4: Làm việc với đặc trưng văn bản

Feature Engineering cho Machine Learning bằng Python

Pandas

import pandas as pd  
df = pd.read_csv(path_to_csv_file)
print(df.head())
Feature Engineering cho Machine Learning bằng Python

Bộ dữ liệu

              SurveyDate  \
0    2018-02-28 20:20:00     
1    2018-06-28 13:26:00     
2    2018-06-06 03:37:00     
3    2018-05-09 01:06:00     
4    2018-04-12 22:41:00    

                              FormalEducation
0    Bachelor's degree (BA. BS. B.Eng.. etc.)
1    Bachelor's degree (BA. BS. B.Eng.. etc.)
2    Bachelor's degree (BA. BS. B.Eng.. etc.)
3    Some college/university study  ...
4    Bachelor's degree (BA. BS. B.Eng.. etc.)
Feature Engineering cho Machine Learning bằng Python

Tên cột

print(df.columns)
Index(['SurveyDate', 'FormalEducation',
       'ConvertedSalary', 'Hobby', 'Country',
       'StackOverflowJobsRecommend', 'VersionControl', 
       'Age', 'Years Experience', 'Gender', 
       'RawSalary'], dtype='object')
Feature Engineering cho Machine Learning bằng Python

Kiểu dữ liệu cột

print(df.dtypes)
SurveyDate                            object
FormalEducation                       object
ConvertedSalary                      float64
...
Years Experience                       int64
Gender                                object
RawSalary                             object
dtype: object
Feature Engineering cho Machine Learning bằng Python

Chọn theo kiểu dữ liệu cụ thể

only_ints = df.select_dtypes(include=['int'])
print(only_ints.columns)
Index(['Age', 'Years Experience'], dtype='object')
Feature Engineering cho Machine Learning bằng Python

Bắt đầu thôi!

Feature Engineering cho Machine Learning bằng Python

Preparing Video For Download...