Created
October 9, 2020 16:07
-
-
Save tiaplagata/77b3eb6a9c7a8a9e1c05cc7958c914bc to your computer and use it in GitHub Desktop.
Standard Normalize Features for Linear Regression
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Write function to standard normalize one feature | |
def std_normalize_feature(feature): | |
""" | |
input a feature column name | |
returns series of normalized feature values | |
""" | |
return (feature - feature.mean()) / feature.std() | |
# Apply function to our previous log_df | |
df_log_normal = df_log.apply(std_normalize_feature) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment