Log normalization in Python
Now that we know that the Proline column in our wine dataset has a large amount of variance, let's log normalize it.
numpy has been imported as np.
Diese Übung ist Teil des Kurses
Preprocessing for Machine Learning in Python
Anleitung zur Übung
- Print out the variance of the
Prolinecolumn for reference. - Use the
np.log()function on theProlinecolumn to create a new, log-normalized column namedProline_log. - Print out the variance of the
Proline_logcolumn to see the difference.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Print out the variance of the Proline column
print(____)
# Apply the log normalization function to the Proline column
wine[____] = np.____(____)
# Check the variance of the normalized Proline column
print(____)