Waarom features genereren?

Feature engineering voor Machine Learning in Python

Robert O'Callaghan

Director of Data Science, Ordergroove

Feature engineering

Feature engineering voor Machine Learning in Python

Verschillende datatypes

  • Continu: gehele getallen of floats (decimalen)
  • Categoraal: beperkte set waarden, bv. gender, geboorteland
  • Ordinaal: gerangschikte waarden, vaak zonder afstand
  • Booleaans: True/False
  • Datetime: datums en tijden
Feature engineering voor Machine Learning in Python

Cursusopzet

  • Hoofdstuk 1: Featurecreatie en -extractie

  • Hoofdstuk 2: Werken met rommelige data

  • Hoofdstuk 3: Normalisatie van features

  • Hoofdstuk 4: Werken met tekstfeatures

Feature engineering voor Machine Learning in Python

Pandas

import pandas as pd  
df = pd.read_csv(path_to_csv_file)
print(df.head())
Feature engineering voor Machine Learning in Python

Dataset

              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 voor Machine Learning in Python

Kolomnamen

print(df.columns)
Index(['SurveyDate', 'FormalEducation',
       'ConvertedSalary', 'Hobby', 'Country',
       'StackOverflowJobsRecommend', 'VersionControl', 
       'Age', 'Years Experience', 'Gender', 
       'RawSalary'], dtype='object')
Feature engineering voor Machine Learning in Python

Kolomtypes

print(df.dtypes)
SurveyDate                            object
FormalEducation                       object
ConvertedSalary                      float64
...
Years Experience                       int64
Gender                                object
RawSalary                             object
dtype: object
Feature engineering voor Machine Learning in Python

Specifieke datatypes selecteren

only_ints = df.select_dtypes(include=['int'])
print(only_ints.columns)
Index(['Age', 'Years Experience'], dtype='object')
Feature engineering voor Machine Learning in Python

Laten we beginnen!

Feature engineering voor Machine Learning in Python

Preparing Video For Download...