Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Preprocessing for Machine Learning in Python

Cursus bekijken

Oefeninstructies

  • Print out the variance of the Proline column for reference.
  • Use the np.log() function on the Proline column to create a new, log-normalized column named Proline_log.
  • Print out the variance of the Proline_log column to see the difference.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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(____)
Code bewerken en uitvoeren