April 2018
Beginner to intermediate
282 pages
6h 52m
English
The log and power transformation often helps the non-tree-based models by making highly-skewed distributions less skewed. This preprocessing technique helps meet the assumptions of linear regression models and assumptions of inferential statistics. Some examples of this type of transformation includes—log transformation, square root transformation, and log-log transformation.
The following is a demonstration of square root transformation using a dummy dataset:
import numpy as npvalues = np.array([-4, 6, 68, 46, 89, -25])# Square root transformation #sqrt_trnsf_values = np.sqrt(np.abs(values)) * np.sign(values)print(sqrt_trnsf_values)
The following is the output of the preceding square root transformation: