1. Learn
  2. /
  3. Courses
  4. /
  5. Predicting CTR with Machine Learning in Python

Exercise

Log normalization

Standardization is important to make sure all features are comparable. Log normalization is a common method of standardization. You will check the variance of select features and compute the overall median variance among features. The features will be the numeric ones, except for the click column, banner_pos, device_type, and columns search_engine_type, product_type, advertiser_type from last lesson since they are actually categorical columns. Then you will apply log normalization to these columns with a variance higher than the median variance and check results.

The pandas module is available as pd in your workspace and the sample DataFrame is loaded as df.

Instructions 1/2

undefined XP
    1
    2
  • Select the numeric columns and exclude particular columns using .isin() on filter_cols.
  • Print out the variance of each column using .var() (don't forget the parentheses!).
  • Calculate and print the median variance using .median().