왜 특성을 생성할까요?

Python으로 배우는 Machine Learning 특성 공학

Robert O'Callaghan

Director of Data Science, Ordergroove

특성 공학(Feature Engineering)

Python으로 배우는 Machine Learning 특성 공학

데이터 유형

  • 연속형: 정수(자연수) 또는 실수(소수)
  • 범주형: 제한된 값 중 하나, 예: 성별, 출생 국가
  • 순서형: 순서만 있고 간격 정보는 없음
  • 불리언: True/False 값
  • 날짜/시간: 날짜와 시간
Python으로 배우는 Machine Learning 특성 공학

강의 구성

  • 1장: 특성 생성과 추출

  • 2장: 지저분한 데이터 다루기

  • 3장: 특성 정규화

  • 4장: 텍스트 특성 처리

Python으로 배우는 Machine Learning 특성 공학

Pandas

import pandas as pd  
df = pd.read_csv(path_to_csv_file)
print(df.head())
Python으로 배우는 Machine Learning 특성 공학

데이터셋

              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.)
Python으로 배우는 Machine Learning 특성 공학

열 이름

print(df.columns)
Index(['SurveyDate', 'FormalEducation',
       'ConvertedSalary', 'Hobby', 'Country',
       'StackOverflowJobsRecommend', 'VersionControl', 
       'Age', 'Years Experience', 'Gender', 
       'RawSalary'], dtype='object')
Python으로 배우는 Machine Learning 특성 공학

열 타입

print(df.dtypes)
SurveyDate                            object
FormalEducation                       object
ConvertedSalary                      float64
...
Years Experience                       int64
Gender                                object
RawSalary                             object
dtype: object
Python으로 배우는 Machine Learning 특성 공학

특정 데이터 타입 선택

only_ints = df.select_dtypes(include=['int'])
print(only_ints.columns)
Index(['Age', 'Years Experience'], dtype='object')
Python으로 배우는 Machine Learning 특성 공학

시작해 봅시다!

Python으로 배우는 Machine Learning 특성 공학

Preparing Video For Download...