LoslegenKostenlos loslegen

Square root transformation

In the video you learned that the logarithmic function can be used to flatten out differences between values. An alternative for the logarithmic function is the square root: this function will also flatten out differences between values but the effect is slightly weaker.

Given is a very small basetable with population 4 donors and the predictive variable "donations" that has the total amount of donations last year. In this exercise you will add the logarithmic and square root transformation to this basetable and compare the effect of both transformations.

Diese Übung ist Teil des Kurses

Intermediate Predictive Analytics in Python

Kurs anzeigen

Anleitung zur Übung

  • Add the log transformation of the variable "donations" to the basetable.
  • Add the square root transformation of the variable "donations" to the basetable.
  • Print the basetable with these added features.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Add the log transformation of the variable "donations"
basetable["donations_log"] = ____.____(____["____"])

# Add the square root transformation of the variable "donations"
basetable["donations_sqrt"] = ____.____(____["____"])

# Compare the transformations
___
Code bearbeiten und ausführen